Documentation
¶
Index ¶
- type Config
- type MemoryCache
- func (mc *MemoryCache) Clear(ctx context.Context) error
- func (mc *MemoryCache) Close() error
- func (mc *MemoryCache) Delete(ctx context.Context, key string) error
- func (mc *MemoryCache) Exists(ctx context.Context, key string) (bool, error)
- func (mc *MemoryCache) Get(ctx context.Context, key string) ([]byte, error)
- func (mc *MemoryCache) Ping(ctx context.Context) error
- func (mc *MemoryCache) Set(ctx context.Context, key string, value []byte, ttl time.Duration) error
- func (mc *MemoryCache) Stats() map[string]interface{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
MaxSize int64
MaxKeys int
DefaultTTL time.Duration
CleanupInterval time.Duration
KeyPrefix string
Namespace string
}
Config holds memory cache specific configuration
type MemoryCache ¶
type MemoryCache struct {
// contains filtered or unexported fields
}
MemoryCache implements an in-memory cache
func (*MemoryCache) Clear ¶
func (mc *MemoryCache) Clear(ctx context.Context) error
Clear removes all keys
func (*MemoryCache) Delete ¶
func (mc *MemoryCache) Delete(ctx context.Context, key string) error
Delete removes a key
func (*MemoryCache) Ping ¶
func (mc *MemoryCache) Ping(ctx context.Context) error
Ping checks if cache is operational
func (*MemoryCache) Stats ¶
func (mc *MemoryCache) Stats() map[string]interface{}
Stats returns cache statistics
Click to show internal directories.
Click to hide internal directories.