Documentation ¶
Index ¶
Constants ¶
View Source
const ( // AgentCachePrefix is the common root to use to prefix all the cache // keys for any value regarding the Agent AgentCachePrefix = "agent" // NoExpiration maps to go-cache corresponding value NoExpiration = cache.NoExpiration )
Variables ¶
View Source
var Cache = cache.New(defaultExpire, defaultPurge)
Cache provides an in-memory key:value store similar to memcached
Functions ¶
func BuildAgentKey ¶
BuildAgentKey creates a cache key by joining the constant AgentCachePrefix and path elements passed as arguments. It is to be used by core agent packages to reuse the prefix constant
Types ¶
type BasicCache ¶
type BasicCache struct {
// contains filtered or unexported fields
}
BasicCache is a simple threadsafe cache
func (*BasicCache) Add ¶
func (b *BasicCache) Add(k string, v interface{})
Add adds value to cache for specified key
func (*BasicCache) Get ¶
func (b *BasicCache) Get(k string) (interface{}, error)
Get gets interface for specified key or error
func (*BasicCache) GetModified ¶
func (b *BasicCache) GetModified() int64
GetModified gets interface for specified key or error
func (*BasicCache) Items ¶
func (b *BasicCache) Items() map[string]interface{}
Items returns a map with the elements in the cache
func (*BasicCache) Remove ¶
func (b *BasicCache) Remove(k string)
Remove removes an entry from the cache if it exists
func (*BasicCache) Size ¶
func (b *BasicCache) Size() int
Size returns the current size of the cache
Click to show internal directories.
Click to hide internal directories.