Documentation
¶
Overview ¶
Package cache provides a dependency free store based cache with the ability to add new storage methods by implementing a new store.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultMaxAge = MaxAge(1800)
DefaultMaxAge is used to define the MaxAge if one is not set for an individual store. This needs to be implemented at the store level on initialization.
Functions ¶
func StopAll ¶
func StopAll() error
StopAll gracefully closes the all cache instances. It should stop the trim() worker. Purge the cache and remove the root directory. Reset caches to an empty map.
func StopCacheInstance ¶
StopCacheInstance gracefully closes the specified cache instances. It should stop the trim() worker. Purge the cache by calling purge(). Remove the cache from the active Caches map.
Types ¶
type MaxAge ¶
MaxAge Defines the maximum allowed age of items stored in the cache measured in seconds. MaxAge = 1800 would set the MaxAge for all files to 30 minutes. This needs to be implemented for each store and used with the store specific Purge() method
type Options ¶
type Options struct {
// CacheNum is used to call which cache the user wants to use.
// This is set when the cache instance is started and should be saved to access the cache later.
CacheNum int
// Stores is used to access the current caches active stores
Stores Stores
// TrimTime Defines the interval at which trim() calls the store specified Trim() method
// to check the MaxAge of items the store.
// TrimTime = 900 would set TrimTime to 15 minutes
TrimTime time.Duration
// contains filtered or unexported fields
}
Options sets an individual caches options