Documentation ¶
Index ¶
- Variables
- type KVStore
- func (kvs *KVStore) Delete(key string)
- func (kvs *KVStore) Get(key string) (interface{}, bool)
- func (kvs *KVStore) Keys() []string
- func (kvs *KVStore) Len() int
- func (kvs *KVStore) Reap(results bool) map[string]interface{}
- func (kvs *KVStore) Set(key string, value interface{}, ttl time.Duration)
- func (kvs *KVStore) SetNX(key string, value interface{}, ttl time.Duration) bool
Constants ¶
This section is empty.
Variables ¶
var ( // NumStores is how many buckets to divide between NumStores uint32 = 64 // NumReapers is how many concurrent buckets to reap at a time NumReapers uint8 = 4 )
Functions ¶
This section is empty.
Types ¶
type KVStore ¶
type KVStore struct {
// contains filtered or unexported fields
}
KVStore is our primary key-value store. It is a parent container/controller used for all operations Do not use the empty value of this struct, it will panic. Use NewKVStore()
func (*KVStore) Get ¶
Get gets the value stored at key, and whether or not it existed Always check the existed value, as the return value will always be nil if it's false
func (*KVStore) Keys ¶
Keys returns all of the keys in a slice This is used for iterating, as one can use a Get on each key
func (*KVStore) Reap ¶
Reap stops the world to scan the entire map and evicts expired things. results is whether or not to collect deleted keys for return If results is false, the returned map will always be nil It does not run automatically, and is meant to be user implementable.