enable a 300sec in memory cache for resource infos when listing shares on the ocs API (#4438)
* enable a 300sec in memory cache for resource infos when listing shares on the ocs API Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * lint Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * disable ocs cache by default Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
1 parent
a35b2fc9ef
commit
b0fa917eae
3 files changed
+29
-5
No files matched your search
@@ -110,11 +110,25 @@ type OCS struct {
|
|||||||
SharePrefix string `yaml:"share_prefix" env:"FRONTEND_OCS_SHARE_PREFIX" desc:"Path prefix for shares."`
|
SharePrefix string `yaml:"share_prefix" env:"FRONTEND_OCS_SHARE_PREFIX" desc:"Path prefix for shares."`
|
||||||
HomeNamespace string `yaml:"home_namespace" env:"FRONTEND_OCS_HOME_NAMESPACE" desc:"Homespace namespace identifier."`
|
HomeNamespace string `yaml:"home_namespace" env:"FRONTEND_OCS_HOME_NAMESPACE" desc:"Homespace namespace identifier."`
|
||||||
AdditionalInfoAttribute string `yaml:"additional_info_attribute" env:"FRONTEND_OCS_ADDITIONAL_INFO_ATTRIBUTE" desc:"Additional information attribute for the user like {{.Mail}}."`
|
AdditionalInfoAttribute string `yaml:"additional_info_attribute" env:"FRONTEND_OCS_ADDITIONAL_INFO_ATTRIBUTE" desc:"Additional information attribute for the user like {{.Mail}}."`
|
||||||
ResourceInfoCacheTTL int `yaml:"resource_info_cache_ttl" env:"FRONTEND_OCS_RESOURCE_INFO_CACHE_TTL" desc:"Max TTL for the resource info cache."`
|
ResourceInfoCacheTTL int `yaml:"resource_info_cache_ttl" env:"FRONTEND_OCS_RESOURCE_INFO_CACHE_TTL" desc:"Max TTL for the resource info cache. 0 disables the cache."`
|
||||||
|
ResourceInfoCacheType string `yaml:"resource_info_cache_type" env:"FRONTEND_OCS_RESOURCE_INFO_CACHE_TYPE" desc:"Resource info cache type ('memory' or 'redis')."`
|
||||||
|
ResourceInfoCaches ResourceInfoCaches `yaml:"resource_info_caches,omitempty"` // only used for redis
|
||||||
CacheWarmupDriver string `yaml:"cache_warmup_driver,omitempty"` // not supported by the oCIS product, therefore not part of docs
|
CacheWarmupDriver string `yaml:"cache_warmup_driver,omitempty"` // not supported by the oCIS product, therefore not part of docs
|
||||||
CacheWarmupDrivers CacheWarmupDrivers `yaml:"cache_warmup_drivers,omitempty"` // not supported by the oCIS product, therefore not part of docs
|
CacheWarmupDrivers CacheWarmupDrivers `yaml:"cache_warmup_drivers,omitempty"` // not supported by the oCIS product, therefore not part of docs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ResourceInfoCaches holds resource info cache configurations
|
||||||
|
type ResourceInfoCaches struct {
|
||||||
|
Redis RedisDriver `yaml:"redis,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// RedisDriver holds redis configuration
|
||||||
|
type RedisDriver struct {
|
||||||
|
Address string `yaml:"address" env:"FRONTEND_OCS_RESOURCE_INFO_CACHE_REDIS_ADDR" desc:"Redis service address"`
|
||||||
|
Username string `yaml:"username" env:"FRONTEND_OCS_RESOURCE_INFO_CACHE_REDIS_USERNAME" desc:"Redis username"`
|
||||||
|
Password string `yaml:"password" env:"FRONTEND_OCS_RESOURCE_INFO_CACHE_REDIS_PASSWORD" desc:"Redis password"`
|
||||||
|
}
|
||||||
|
|
||||||
type CacheWarmupDrivers struct {
|
type CacheWarmupDrivers struct {
|
||||||
CBOX CBOXDriver `yaml:"cbox,omitempty"`
|
CBOX CBOXDriver `yaml:"cbox,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ func DefaultConfig() *config.Config {
|
|||||||
SharePrefix: "/Shares",
|
SharePrefix: "/Shares",
|
||||||
HomeNamespace: "/users/{{.Id.OpaqueId}}",
|
HomeNamespace: "/users/{{.Id.OpaqueId}}",
|
||||||
AdditionalInfoAttribute: "{{.Mail}}",
|
AdditionalInfoAttribute: "{{.Mail}}",
|
||||||
|
ResourceInfoCacheType: "memory",
|
||||||
ResourceInfoCacheTTL: 0,
|
ResourceInfoCacheTTL: 0,
|
||||||
},
|
},
|
||||||
Middleware: config.Middleware{
|
Middleware: config.Middleware{
|
||||||
|
|||||||
@@ -125,10 +125,19 @@ func FrontendConfigFromStruct(cfg *config.Config) (map[string]interface{}, error
|
|||||||
"insecure": true,
|
"insecure": true,
|
||||||
},
|
},
|
||||||
"ocs": map[string]interface{}{
|
"ocs": map[string]interface{}{
|
||||||
"storage_registry_svc": cfg.Reva.Address,
|
"storage_registry_svc": cfg.Reva.Address,
|
||||||
"share_prefix": cfg.OCS.SharePrefix,
|
"share_prefix": cfg.OCS.SharePrefix,
|
||||||
"home_namespace": cfg.OCS.HomeNamespace,
|
"home_namespace": cfg.OCS.HomeNamespace,
|
||||||
"resource_info_cache_ttl": cfg.OCS.ResourceInfoCacheTTL,
|
"resource_info_cache_ttl": cfg.OCS.ResourceInfoCacheTTL,
|
||||||
|
"resource_info_cache_type": cfg.OCS.ResourceInfoCacheType,
|
||||||
|
"resource_info_caches": map[string]interface{}{
|
||||||
|
// memory has no additional config
|
||||||
|
"redis": map[string]interface{}{
|
||||||
|
"redis_address": cfg.OCS.ResourceInfoCaches.Redis.Address,
|
||||||
|
"redis_username": cfg.OCS.ResourceInfoCaches.Redis.Username,
|
||||||
|
"redis_password": cfg.OCS.ResourceInfoCaches.Redis.Password,
|
||||||
|
},
|
||||||
|
},
|
||||||
"prefix": cfg.OCS.Prefix,
|
"prefix": cfg.OCS.Prefix,
|
||||||
"additional_info_attribute": cfg.OCS.AdditionalInfoAttribute,
|
"additional_info_attribute": cfg.OCS.AdditionalInfoAttribute,
|
||||||
"machine_auth_apikey": cfg.MachineAuthAPIKey,
|
"machine_auth_apikey": cfg.MachineAuthAPIKey,
|
||||||
|
|||||||
Reference in new issue
Block a user