Documentation
¶
Overview ¶
Provides a few useful thread-safe data-structures
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheResult ¶
type CacheResult struct {
// Result value
V interface{}
// Indicates whether it exists in the cache or not
Found bool
}
Represents value in cache and whether it exists or not
type LRUCache ¶
type LRUCache interface {
// Retrieves multiple items from the cache
GetMultiple(keys []string) []CacheResult
// Retrieves a single item from the cache and whether it exists
Get(key string) (v interface{}, found bool)
// Sets a single item in the cache
Set(key string, v interface{})
// Sets multiple items in the cache
SetMultiple(keyValues map[string]interface{})
// Deletes one or more keys
Delete(keys ...string)
// Clears the cache
Clear()
// Retrieves the maximum size of the cache
MaxSize() int
}
A thread-safe version of LRUCache
func NewLRUCache ¶
type Map ¶
type Map interface {
// Retrieves an item from the map an indicates whether it exists or not
Get(key interface{}) (interface{}, bool)
// Sets the value for a particular item in the map
Set(key interface{}, value interface{})
// Deletes an item from the map with the provided key
Delete(key interface{})
// Retrieves the size of the map
Len() int
}
A thread-safe version of map
Click to show internal directories.
Click to hide internal directories.