github.com/hdt3213/godis@v1.2.9/datastruct/dict/dict.go (about)

     1  package dict
     2  
     3  // Consumer is used to traversal dict, if it returns false the traversal will be break
     4  type Consumer func(key string, val interface{}) bool
     5  
     6  // Dict is interface of a key-value data structure
     7  type Dict interface {
     8  	Get(key string) (val interface{}, exists bool)
     9  	Len() int
    10  	Put(key string, val interface{}) (result int)
    11  	PutIfAbsent(key string, val interface{}) (result int)
    12  	PutIfExists(key string, val interface{}) (result int)
    13  	Remove(key string) (result int)
    14  	ForEach(consumer Consumer)
    15  	Keys() []string
    16  	RandomKeys(limit int) []string
    17  	RandomDistinctKeys(limit int) []string
    18  	Clear()
    19  }