1
0
mirror of https://github.com/charlienet/go-mixed.git synced 2025-07-18 00:22:41 +08:00
This commit is contained in:
2022-04-26 17:11:45 +08:00
parent 78c957c98e
commit fb9f70d150
10 changed files with 483 additions and 0 deletions

31
cache/options.go vendored Normal file
View File

@ -0,0 +1,31 @@
package cache
type option func(*Cache)
type options struct {
Prefix string
}
func WithPrefix(prefix string) option {
return func(o *Cache) { o.prefix = prefix }
}
func WithDistributdCache(d DistributdCache) option {
return func(o *Cache) { o.distributdCache = d }
}
func WithBigCache(config *BigCacheConfig) option {
return func(o *Cache) {
c, err := NewBigCache(config)
_ = err
o.mem = c
}
}
func WithFreeCache(size int) option {
return func(o *Cache) { o.mem = NewFreeCache(size) }
}
func WithPublishSubscribe(p PublishSubscribe) option {
return func(o *Cache) {}
}