Documentation ¶
Overview ¶
Package edge An open-source library for golang developer
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { // Set saves value under the key, treat the key as nonexistent // If key already exist, old value will be return // If key not exist, nil will be return Set(key string, val interface{}) interface{} // Get reads value under the key. // If key not exist, < nil, false> will be return Get(key string) (value interface{}, ok bool) // Delete removes the key in cache // If key not exist, false will be return Delete(key string) (present bool) // Exists returns whether the key exists in the cache. Exists(key string) bool // Cap returns maximum capacity of the cache. Cap() int // Len returns how many keys are currently stored in the cache. Len() int }
Cache is the common interface implemented by many kinds of cache algorithms
type ConsistentHash ¶
type ConsistentHash interface { // Add Saves server node into hash Add(s Server) // Remove deletes server node from hash Remove(node Server) // Get returns an server node close to key hash. Get(key string) Server }
ConsistentHash was first described in a paper, ["Consistent hashing and random trees: Distributed caching protocols for relieving hot spots on the World Wide Web (1997)"](http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.147.1879) by David Karger et al. It is used in distributed storage systems like Amazon Dynamo and memcached.
Directories ¶
Path | Synopsis |
---|---|
Package lru implements lru algorithm using linked list and hash map
|
Package lru implements lru algorithm using linked list and hash map |
internal
|
|
Click to show internal directories.
Click to hide internal directories.