Documentation ¶
Overview ¶
Package cache defines the Trickster cache interfaces and provides general cache functionality
Index ¶
- Variables
- func CacheError(cacheKey, cacheName, cacheType string, msg string) ([]byte, error)
- func ObserveCacheDel(cache, cacheType string, count float64)
- func ObserveCacheEvent(cache, cacheType, event, reason string)
- func ObserveCacheMiss(cacheKey, cacheName, cacheType string) ([]byte, error)
- func ObserveCacheOperation(cache, cacheType, operation, status string, bytes float64)
- func ObserveCacheSizeChange(cache, cacheType string, byteCount, objectCount int64)
- type Cache
- type MemoryCache
- type ReferenceObject
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 ¶
func CacheError ¶
CacheError returns an empty cache object and the formatted error
func ObserveCacheDel ¶
ObserveCacheDel records a cache deletion event
func ObserveCacheEvent ¶
func ObserveCacheEvent(cache, cacheType, event, reason string)
ObserveCacheEvent increments counters as cache events occur
func ObserveCacheMiss ¶
ObserveCacheMiss returns a standard Cache Miss response
func ObserveCacheOperation ¶
ObserveCacheOperation increments counters as cache operations occur
func ObserveCacheSizeChange ¶
ObserveCacheSizeChange adjust counters and gauges as the cache size changes due to object operations
Types ¶
type Cache ¶
type Cache interface { Connect() error Store(cacheKey string, data []byte, ttl time.Duration) error Retrieve(cacheKey string, allowExpired bool) ([]byte, status.LookupStatus, error) SetTTL(cacheKey string, ttl time.Duration) Remove(cacheKey string) BulkRemove(cacheKeys []string) Close() error Configuration() *config.CachingConfig }
Cache is the interface for the supported caching fabrics When making new cache types, Retrieve() must return an error on cache miss
type MemoryCache ¶
type MemoryCache interface { Connect() error Store(cacheKey string, data []byte, ttl time.Duration) error Retrieve(cacheKey string, allowExpired bool) ([]byte, status.LookupStatus, error) SetTTL(cacheKey string, ttl time.Duration) Remove(cacheKey string) BulkRemove(cacheKeys []string) Close() error Configuration() *config.CachingConfig StoreReference(cacheKey string, data ReferenceObject, ttl time.Duration) error RetrieveReference(cacheKey string, allowExpired bool) (interface{}, 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 a sync.Map to manage cache objects
|
Package memory is the memory implementation of the Trickster Cache and uses a sync.Map to manage cache objects |
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 registration handles the registration of cache implementations to be used by proxy cache handlers
|
Package registration 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 |