diff --git a/changelog/unreleased/fix-graph-ttl-cache.md b/changelog/unreleased/fix-graph-ttl-cache.md new file mode 100644 index 0000000000..ccd0fbab23 --- /dev/null +++ b/changelog/unreleased/fix-graph-ttl-cache.md @@ -0,0 +1,7 @@ +Bugfix: Reduced default TTL of user and group caches in graph API + +We reduced the default TTL of the cache for user and group information on the +/drives endpoints to 60 seconds. This fixes in issue where outdated information +was show on the spaces list for a very long time. + +https://github.com/owncloud/ocis/issues/6320 diff --git a/services/graph/pkg/config/defaults/defaultconfig.go b/services/graph/pkg/config/defaults/defaultconfig.go index 42545f19a3..fbe5b0cd7d 100644 --- a/services/graph/pkg/config/defaults/defaultconfig.go +++ b/services/graph/pkg/config/defaults/defaultconfig.go @@ -53,12 +53,12 @@ func DefaultConfig() *config.Config { WebDavBase: "https://localhost:9200", WebDavPath: "/dav/spaces/", DefaultQuota: "1000000000", - // 30 minutes - ExtendedSpacePropertiesCacheTTL: 1800, - // 30 minutes - GroupsCacheTTL: 1800, - // 30 minutes - UsersCacheTTL: 1800, + // 1 minute + ExtendedSpacePropertiesCacheTTL: 60, + // 1 minute + GroupsCacheTTL: 60, + // 1 minute + UsersCacheTTL: 60, }, Identity: config.Identity{ Backend: "ldap", diff --git a/services/graph/pkg/service/v0/service.go b/services/graph/pkg/service/v0/service.go index 234e182fbe..5c46f716e1 100644 --- a/services/graph/pkg/service/v0/service.go +++ b/services/graph/pkg/service/v0/service.go @@ -115,6 +115,7 @@ func NewService(opts ...Option) (Graph, error) { ttlcache.WithTTL[string, interface{}]( time.Duration(options.Config.Spaces.ExtendedSpacePropertiesCacheTTL), ), + ttlcache.WithDisableTouchOnHit[string, interface{}](), ) go spacePropertiesCache.Start() @@ -122,6 +123,7 @@ func NewService(opts ...Option) (Graph, error) { ttlcache.WithTTL[string, libregraph.User]( time.Duration(options.Config.Spaces.UsersCacheTTL), ), + ttlcache.WithDisableTouchOnHit[string, libregraph.User](), ) go usersCache.Start() @@ -129,6 +131,7 @@ func NewService(opts ...Option) (Graph, error) { ttlcache.WithTTL[string, libregraph.Group]( time.Duration(options.Config.Spaces.GroupsCacheTTL), ), + ttlcache.WithDisableTouchOnHit[string, libregraph.Group](), ) go groupsCache.Start()