tercul-backend/internal/data/cache/options.go

26 lines
488 B
Go

package cache
import (
"time"
platform_cache "tercul/internal/platform/cache"
)
type Options struct {
Enabled bool
Cache platform_cache.Cache
Keys platform_cache.KeyGenerator
EntityTTL time.Duration
ListTTL time.Duration
}
func DefaultOptions(c platform_cache.Cache) Options {
return Options{
Enabled: c != nil,
Cache: c,
Keys: platform_cache.NewDefaultKeyGenerator("tercul:repo:"),
EntityTTL: 1 * time.Hour,
ListTTL: 5 * time.Minute,
}
}