@@ -17,6 +17,9 @@ package server
1717import (
1818 "fmt"
1919
20+ "github.com/c2h5oh/datasize"
21+ "github.com/die-net/lrucache"
22+ "github.com/gregjones/httpcache"
2023 "github.com/palantir/go-baseapp/baseapp"
2124 "github.com/palantir/go-baseapp/baseapp/datadog"
2225 "github.com/palantir/go-githubapp/githubapp"
@@ -48,10 +51,16 @@ func New(c *Config) (*Server, error) {
4851 return nil , errors .Wrap (err , "failed to initialize base server" )
4952 }
5053
54+ maxSize := int64 (50 * datasize .MB )
55+ if c .Cache .MaxSize != 0 {
56+ maxSize = int64 (c .Cache .MaxSize )
57+ }
58+
5159 userAgent := fmt .Sprintf ("%s/%s" , c .Options .AppName , version .GetVersion ())
5260 clientCreator , err := githubapp .NewDefaultCachingClientCreator (
5361 c .Github ,
5462 githubapp .WithClientUserAgent (userAgent ),
63+ githubapp .WithClientCaching (true , func () httpcache.Cache { return lrucache .New (maxSize , 0 ) }),
5564 githubapp .WithClientMiddleware (
5665 githubapp .ClientLogging (zerolog .DebugLevel ),
5766 githubapp .ClientMetrics (base .Registry ()),
0 commit comments