Documentation ¶
Overview ¶
Provide a standardised interface for using our backend caches Insert/InsertTTL should be ran in goroutines to avoid waiting for results Retrieve/TTL functions should return the same error `ErrNotFound` when the key does not exist TTL functions should return `ErrNoExpiry` if they key was found, but no expiry info was found
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( RetrieveKV = storage.RetrieveKV RetrieveGob = storage.RetrieveGob ErrNotFound = storage.ErrNotFound )
View Source
var (
ErrNoExpiry = errors.New("key does not have an associated Expiry/TTL")
)
Errors
Functions ¶
Types ¶
type Cache ¶
type Cache interface { // Name returns the CacheConfig Name Name() string // Implements storage.Storage interface storage.Storage // InsertTTL inserts a new value into the store with the given expiry InsertTTL(key string, value []byte, ttl time.Duration) error // TTL returns the existing TTL for a key and an optional error // The expectation is that the Cache will handle whether this is a TTL(key string) (time.Duration, error) // Start the cache / expiry tracker Start() // Stop the cache / expiry tracker Stop() }
type CacheConfig ¶
func (*CacheConfig) RegisterFlags ¶
func (c *CacheConfig) RegisterFlags(f *flag.FlagSet, cacheID string)
Directories ¶
Path | Synopsis |
---|---|
Migrate from bolt to badger
|
Migrate from bolt to badger |
util
|
|
expiry
Common methods for Expiry packages Common methods for Expiry packages
|
Common methods for Expiry packages Common methods for Expiry packages |
expiry/memory
memory is a thread safe library for handling TTL of keys as an expiry solution, `memory` is only suitable of in-memory store as the exoiry records do not persist
|
memory is a thread safe library for handling TTL of keys as an expiry solution, `memory` is only suitable of in-memory store as the exoiry records do not persist |
expiry/store
Implement expiry within the the actual value storage The underlying store will need to use this when Inserting/Retrieving
|
Implement expiry within the the actual value storage The underlying store will need to use this when Inserting/Retrieving |
Click to show internal directories.
Click to hide internal directories.