mirror of
https://github.com/HDT3213/godis.git
synced 2025-10-05 08:46:56 +08:00
21 lines
687 B
Go
21 lines
687 B
Go
package dict
|
|
|
|
// Consumer is used to traversal dict, if it returns false the traversal will be break
|
|
type Consumer func(key string, val interface{}) bool
|
|
|
|
// Dict is interface of a key-value data structure
|
|
type Dict interface {
|
|
Get(key string) (val interface{}, exists bool)
|
|
Len() int
|
|
Put(key string, val interface{}) (result int)
|
|
PutIfAbsent(key string, val interface{}) (result int)
|
|
PutIfExists(key string, val interface{}) (result int)
|
|
Remove(key string) (val interface{}, result int)
|
|
ForEach(consumer Consumer)
|
|
Keys() []string
|
|
RandomKeys(limit int) []string
|
|
RandomDistinctKeys(limit int) []string
|
|
Clear()
|
|
DictScan(cursor int, count int, pattern string) ([][]byte, int)
|
|
}
|