Documentation
¶
Index ¶
- type Config
- type InMemoryCache
- func (imc *InMemoryCache) Delete(_ context.Context, key string) error
- func (imc *InMemoryCache) Flush(_ context.Context)
- func (imc *InMemoryCache) Get(_ context.Context, key string) (any, error)
- func (imc *InMemoryCache) GetByPattern(ctx context.Context, keyPattern string) (map[string]any, error)
- func (imc *InMemoryCache) ItemCount() int
- func (imc *InMemoryCache) ScanKeys(_ context.Context, pattern string) ([]string, error)
- func (imc *InMemoryCache) Set(_ context.Context, key string, value any, ttl time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
DefaultExpiration int32 `yaml:"defaultExpiration" json:"defaultExpiration"`
CleanupInterval int32 `yaml:"cleanupInterval" json:"cleanupInterval"`
}
Config is the configuration for the in-memory cache.
type InMemoryCache ¶
type InMemoryCache struct {
// contains filtered or unexported fields
}
InMemoryCache holds the handler for the in-memory cache using go-cache.
func NewCache ¶
func NewCache(config *Config) (*InMemoryCache, error)
NewCache creates a new in-memory cache instance.
func (*InMemoryCache) Delete ¶
func (imc *InMemoryCache) Delete(_ context.Context, key string) error
Delete removes the value for the given key.
func (*InMemoryCache) Flush ¶
func (imc *InMemoryCache) Flush(_ context.Context)
Flush removes all items from the cache.
func (*InMemoryCache) GetByPattern ¶
func (imc *InMemoryCache) GetByPattern(ctx context.Context, keyPattern string) (map[string]any, error)
GetByPattern returns all values whose keys match the given glob pattern.
func (*InMemoryCache) ItemCount ¶
func (imc *InMemoryCache) ItemCount() int
ItemCount returns the number of items in the cache.
Click to show internal directories.
Click to hide internal directories.