Documentation
¶
Overview ¶
Package cached adds a read-through cache to a store.
Index ¶
Constants ¶
View Source
const DefaultTTL = time.Hour
DefaultTTL is the default lifetime for cached entries.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶ added in v0.3.0
type Config struct {
Enabled bool // Whether reads use the cache.
TTL time.Duration // How long entries remain cached.
Size int // Maximum cache size in megabytes; zero is unlimited.
}
Config controls a local read-through cache.
type Option ¶ added in v0.3.0
type Option func(*Config)
Option configures a cache.
func WithCacheSize ¶ added in v0.3.0
WithCacheSize sets the cache size limit in megabytes. Zero means unlimited.
func WithCacheTTL ¶ added in v0.3.0
WithCacheTTL sets the cache entry lifetime.
Click to show internal directories.
Click to hide internal directories.