Documentation
¶
Overview ¶
Package cache defines a tiny adapter boundary for optional caching layers.
Package cache defines a minimal cache interface for GoMyAdmin adapters.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("cache: key not found")
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface {
Get(ctx context.Context, key string) ([]byte, error)
Set(ctx context.Context, key string, value []byte, ttl time.Duration) error
Delete(ctx context.Context, key string) error
}
Cache is the minimal contract GoMyAdmin adapters need from Redis, Memcached, in-memory caches, or an existing application cache.
type MemoryCache ¶
type MemoryCache struct {
// contains filtered or unexported fields
}
MemoryCache is a small concurrency-safe cache for tests and single-process development. Production deployments should prefer Redis, Memcached, or a shared application cache.
func NewMemory ¶
func NewMemory() *MemoryCache
Click to show internal directories.
Click to hide internal directories.