Documentation ¶
Overview ¶
Package cache provides an interface to cache items. It should not be of any concern to the callee where this cache is, simply that the cache exists and will speed things up.
Eventual consistency of the cached items is promised, but nothing more.
Index ¶
- Constants
- func Delete(key string)
- func Get(key string, dst interface{}) (interface{}, bool)
- func GetBool(key string) (bool, bool)
- func GetInt64(key string) (int64, bool)
- func GetInt64Slice(key string) ([]int64, bool)
- func GetString(key string) (string, bool)
- func InitCache(host string, port int64)
- func Set(key string, data interface{}, timeToLive int32)
- func SetBool(key string, data bool, timeToLive int32)
- func SetInt64(key string, data int64, timeToLive int32)
- func SetInt64Slice(key string, data []int64, timeToLive int32)
- func SetString(key string, data string, timeToLive int32)
Constants ¶
const ( CacheDetail int = 1 CacheSummary int = 2 CacheTitle int = 3 CacheItem int = 4 CacheDomain int = 5 CacheSubdomain int = 6 CacheUser int = 7 CacheProfileIds int = 8 CacheCounts int = 9 CacheOptions int = 10 CacheRootID int = 11 // Used only by the site type CacheBreadcrumb int = 12 CacheAttributes int = 13 )
Maintains a list of constants that determine the type of content held in a key. A single ID may have multiple bits of data, i.e.
key_1 = 'detail for ID 1' key_2 = 'summary for ID 1'
This allows us to nuke item 1 from cache and to purge the detail and summary for the item at the same time
Variables ¶
This section is empty.
Functions ¶
func Delete ¶
func Delete(key string)
Delete removes items matching the given key from the cache, if it is in the cache
func GetInt64Slice ¶
GetInt64Slice is a utility function to get a slice of int64 from cache
func InitCache ¶
InitCache creates the cache client and enables the cache functions within this package. It is the responsibility of whatever has the values for this function (usually main.go shortly after reading the config file) to call this.
func SetInt64Slice ¶
SetInt64Slice is a utility function to put a slice of int64 into cache
Types ¶
This section is empty.