Documentation ¶
Overview ¶
Package cache is a simple global cache implementation call StartCache() to start the cache thread. then use
AddToCache, FlushCache, RemoveFromCache and FetchFromCache as necessary
Index ¶
- Constants
- func AddCacheSettingDecoders()
- func AddToCache(cacheType string, name string, object interface{})
- func AddToCacheTTLOverride(cacheType string, name string, ttl time.Duration, object interface{})
- func FetchAllOfType(cacheType string) []interface{}
- func FetchFromCache(cacheType string, name string) interface{}
- func FlushCache()
- func FlushCacheByType(cacheType string)
- func RemoveFromCache(cacheType string, name string)
- func StartCache()
- func UpdateCacheTTL(newTTL time.Duration)
Constants ¶
const ( CacheTypeResource = "static:" CacheTypePlugin = "Plugin:" CacheTypeDatabase = "Database:" CacheTypeTemplateHelperPlugin = "templateHelperPlugin:" )
cache object "types"
const MaxTTL = time.Duration(^(uint64(1) << 63))
MaxTTL is the max possible TTL value (aprox 290 years)
Variables ¶
This section is empty.
Functions ¶
func AddCacheSettingDecoders ¶
func AddCacheSettingDecoders()
AddCacheSettingDecoders adds setting decoders for cache settings in config file
func AddToCache ¶
AddToCache caches a object under the given cacheType + name combination.
func AddToCacheTTLOverride ¶
AddToCacheTTLOverride is like AddToCache but allows overriding of global ttl value.
func FetchAllOfType ¶
func FetchAllOfType(cacheType string) []interface{}
FetchAllOfType returns every object in the cache of the given type
func FetchFromCache ¶
FetchFromCache attempts to fetch the object denoted by cacheType + name from the cache. If such an object does not exist in the cache nil is returned.
func FlushCacheByType ¶
func FlushCacheByType(cacheType string)
FlushCacheByType removes all objects in the cache that have the given type
func RemoveFromCache ¶
RemoveFromCache removes the object denoted by cacheType + name from the cache.
func UpdateCacheTTL ¶
UpdateCacheTTL set a new ttl for cache objects (objects already in cache uneffected)
Types ¶
This section is empty.