diff --git a/internal/http/services/owncloud/ocs/config/config.go b/internal/http/services/owncloud/ocs/config/config.go index 20d785c011..266c5308f6 100644 --- a/internal/http/services/owncloud/ocs/config/config.go +++ b/internal/http/services/owncloud/ocs/config/config.go @@ -38,6 +38,7 @@ type Config struct { CacheWarmupDrivers map[string]map[string]interface{} `mapstructure:"cache_warmup_drivers"` ResourceInfoCacheSize int `mapstructure:"resource_info_cache_size"` ResourceInfoCacheTTL int `mapstructure:"resource_info_cache_ttl"` + UserIdentifierCacheTTL int `mapstructure:"user_identifier_cache_ttl"` } // Init sets sane defaults @@ -66,5 +67,9 @@ func (c *Config) Init() { c.ResourceInfoCacheSize = 1000000 } + if c.UserIdentifierCacheTTL == 0 { + c.UserIdentifierCacheTTL = 60 + } + c.GatewaySvc = sharedconf.GetGatewaySVC(c.GatewaySvc) } diff --git a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go index 73167f35e8..39d664efea 100644 --- a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go +++ b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go @@ -70,6 +70,7 @@ type Handler struct { homeNamespace string additionalInfoTemplate *template.Template userIdentifierCache *ttlcache.Cache + userIdentifierCacheTTL time.Duration resourceInfoCache gcache.Cache resourceInfoCacheTTL time.Duration } @@ -100,7 +101,7 @@ func (h *Handler) Init(c *config.Config) { h.additionalInfoTemplate, _ = template.New("additionalInfo").Parse(c.AdditionalInfoAttribute) h.userIdentifierCache = ttlcache.NewCache() - _ = h.userIdentifierCache.SetTTL(24 * time.Hour) + _ = h.userIdentifierCache.SetTTL(time.Second * time.Duration(c.UserIdentifierCacheTTL)) if h.resourceInfoCacheTTL > 0 { cwm, err := getCacheWarmupManager(c)