Documentation
¶
Overview ¶
Package cache defines the Trickster cache interfaces and provides general cache functionality
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrKNF = errors.New("key not found in cache")
ErrKNF represents the error "key not found in cache"
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface {
Connect() error
Store(cacheKey string, data []byte, ttl time.Duration) error
Retrieve(cacheKey string) ([]byte, status.LookupStatus, error)
Remove(cacheKeys ...string) error
Close() error
Configuration() *options.Options
Locker() locks.NamedLocker
SetLocker(locks.NamedLocker)
}
Cache is the interface for the supported caching fabrics When making new cache providers, Retrieve() must return an error on cache miss
type Client ¶
type Client interface {
Connect() error
Store(cacheKey string, data []byte, ttl time.Duration) error
Retrieve(cacheKey string) ([]byte, status.LookupStatus, error)
Remove(cacheKeys ...string) error
Close() error
}
Client is an interface that defines the methods required for a cache client to be used by cache.Cache implementations
type MemoryCache ¶
type MemoryCache interface {
Client
StoreReference(cacheKey string, data ReferenceObject, ttl time.Duration) error
RetrieveReference(cacheKey string) (any, status.LookupStatus, error)
}
MemoryCache is the interface for an in-memory cache This offers an additional method for storing references to bypass serialization
type ReferenceObject ¶
type ReferenceObject interface {
Size() int
}
ReferenceObject defines an interface for a cache object possessing the ability to report the approximate comprehensive byte size of its members, to assist with cache size management
Directories
¶
| Path | Synopsis |
|---|---|
|
Package badger is the BadgerDB implementation of the Trickster Cache
|
Package badger is the BadgerDB implementation of the Trickster Cache |
|
Package bbolt is the bbolt implementation of the Trickster Cache
|
Package bbolt is the bbolt implementation of the Trickster Cache |
|
Package filesystem is the filesystem implementation of the Trickster Cache
|
Package filesystem is the filesystem implementation of the Trickster Cache |
|
Package index defines the Trickster Cache Index
|
Package index defines the Trickster Cache Index |
|
Package memory is the memory implementation of the Trickster Cache and uses ristretto (TinyLFU admission-controlled cache) to manage cache objects
|
Package memory is the memory implementation of the Trickster Cache and uses ristretto (TinyLFU admission-controlled cache) to manage cache objects |
|
Package negative defines the Negative Cache which is a simple lookup map of httpStatus to TTL
|
Package negative defines the Negative Cache which is a simple lookup map of httpStatus to TTL |
|
Package redis is the redis implementation of the Trickster Cache and supports Standalone, Sentinel and Cluster
|
Package redis is the redis implementation of the Trickster Cache and supports Standalone, Sentinel and Cluster |
|
Package registry handles the registration of cache implementations to be used by proxy cache handlers
|
Package registry handles the registration of cache implementations to be used by proxy cache handlers |
|
Package status governs the possible Cache Lookup Status values
|
Package status governs the possible Cache Lookup Status values |