Versions in this module Expand all Collapse all v0 v0.2.0 Mar 25, 2023 v0.1.0 Mar 25, 2023 Changes in this version + const BinaryMemcachedStrategyID + const DEFAULT + const EnvID + const FOREVER + const ID + const InMemoryStoreType + const InMemoryStrategyID + const MemcachedStrategyID + const RedisStrategyID + const StoreFactoryID + const StoreStrategyTag + const UnknownStoreType + var DefaultExpiration = env.Int(EnvID + "_DEFAULT_EXPIRATION", 60000) + var ErrConfigNotFound = fmt.Errorf("cache store config not found") + var ErrInvalidStore = fmt.Errorf("invalid cache store config") + var ErrMiss = fmt.Errorf("cache key not found") + var ErrNotStored = fmt.Errorf("cache element not stored") + var ObserveConfig = env.Bool(EnvID + "_OBSERVE_CONFIG", true) + var StoresConfigPath = env.String(EnvID + "_STORES_CONFIG_PATH", "slate.api.cache.stores") + type IStore interface + Add func(key string, value interface{}, expire time.Duration) error + Decrement func(key string, data uint64) (uint64, error) + Delete func(key string) error + Flush func() error + Get func(key string, value interface{}) error + Increment func(key string, data uint64) (uint64, error) + Replace func(key string, data interface{}, expire time.Duration) error + Set func(key string, value interface{}, expire time.Duration) error + type IStoreFactory interface + Create func(cfg config.IConfig) (IStore, error) + Register func(strategy IStoreStrategy) error + func NewStoreFactory() IStoreFactory + type IStorePool interface + Get func(name string) (IStore, error) + func NewStorePool(cfg config.IManager, factory IStoreFactory) (IStorePool, error) + type IStoreStrategy interface + Accept func(cfg config.IConfig) bool + Create func(cfg config.IConfig) (IStore, error) + type InMemoryStore struct + func NewInMemoryStore(defaultExpiration time.Duration) *InMemoryStore + func (c *InMemoryStore) Add(key string, value interface{}, expire time.Duration) error + func (c *InMemoryStore) Decrement(key string, n uint64) (uint64, error) + func (c *InMemoryStore) Delete(key string) error + func (c *InMemoryStore) Flush() error + func (c *InMemoryStore) Get(key string, value interface{}) error + func (c *InMemoryStore) Increment(key string, n uint64) (uint64, error) + func (c *InMemoryStore) Replace(key string, value interface{}, expire time.Duration) error + func (c *InMemoryStore) Set(key string, value interface{}, expire time.Duration) error + type InMemoryStoreStrategy struct + func NewInMemoryStoreStrategy() *InMemoryStoreStrategy + func (InMemoryStoreStrategy) Accept(cfg config.IConfig) bool + func (InMemoryStoreStrategy) Create(cfg config.IConfig) (IStore, error) + type Provider struct + func (p Provider) Boot(container ...slate.IContainer) error + func (p Provider) Register(container ...slate.IContainer) error + type StoreFactory []IStoreStrategy + func (f *StoreFactory) Register(strategy IStoreStrategy) error + func (f StoreFactory) Create(cfg config.IConfig) (IStore, error)