Documentation
¶
Overview ¶
Package cache provides a factory function to create Cache instances.
Index ¶
Constants ¶
View Source
const (
DefaultDriver = "memory" // Define a default driver
)
View Source
const Module = "storage.cache"
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(cfg *cachev1.CacheConfig, opts ...options.Option) (storageiface.Cache, error)
New creates a new Cache instance based on the provided configuration. It uses the internal factory registry to find the appropriate provider. To use a specific provider (e.g., "redis"), ensure its package is imported for its side effects (e.g., `import _ "path/to/redis/provider"`), which will register the provider's factory.
Types ¶
type Factory ¶ added in v0.2.13
type Factory interface {
NewCache(cfg *cachev1.CacheConfig, opts ...options.Option) (storageiface.Cache, error)
}
Factory is the interface for creating new Cache components.
type FactoryFunc ¶ added in v0.2.13
type FactoryFunc func(cfg *cachev1.CacheConfig, opts ...options.Option) (storageiface.Cache, error)
FactoryFunc is a function type that implements the Factory interface.
func (FactoryFunc) NewCache ¶ added in v0.2.13
func (f FactoryFunc) NewCache(cfg *cachev1.CacheConfig, opts ...options.Option) (storageiface.Cache, error)
NewCache creates a new Cache component based on the provided configuration.
Click to show internal directories.
Click to hide internal directories.