Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrCacheMiss = errors.New("cache miss")
)
Functions ¶
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a cache implementation using gocache for any value type.
func TestCacheClient ¶
TestCacheClient creates a test cache client with predefined options.
type Config ¶
type Config struct {
Driver string `mapstructure:"driver" json:"driver" default:"ristretto"`
RistrettoCache RistrettoConfig `mapstructure:"ristretto" json:"ristretto"`
}
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is a cache manager for any value.
func NewCacheManager ¶
NewCacheManager creates a new cache manager using Ristretto as the backend.
type RistrettoConfig ¶
type RistrettoConfig struct {
// MaxCost is the maximum cost of the cache, can be a number (bytes) or a string like "1gb"
MaxCost string `mapstructure:"max_cost" json:"max_cost" default:"1gb"`
}
CacheRistrettoConfig supports human-friendly size strings like "1gb", "512mb", etc.
func (RistrettoConfig) MaxCostBytes ¶
func (c RistrettoConfig) MaxCostBytes() int64
MaxCostBytes parses MaxCost and returns the value in bytes. Supports suffixes: b, kb, mb, gb, tb (case-insensitive).
Click to show internal directories.
Click to hide internal directories.