dict

package
v1.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2021 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConcurrentDict

type ConcurrentDict struct {
	// contains filtered or unexported fields
}

func MakeConcurrent

func MakeConcurrent(shardCount int) *ConcurrentDict

func (*ConcurrentDict) ForEach

func (dict *ConcurrentDict) ForEach(consumer Consumer)

* may not contains new entry inserted during traversal

func (*ConcurrentDict) Get

func (dict *ConcurrentDict) Get(key string) (val interface{}, exists bool)

func (*ConcurrentDict) Keys

func (dict *ConcurrentDict) Keys() []string

func (*ConcurrentDict) Len

func (dict *ConcurrentDict) Len() int

func (*ConcurrentDict) Put

func (dict *ConcurrentDict) Put(key string, val interface{}) (result int)

return the number of new inserted key-value

func (*ConcurrentDict) PutIfAbsent

func (dict *ConcurrentDict) PutIfAbsent(key string, val interface{}) (result int)

return the number of updated key-value

func (*ConcurrentDict) PutIfExists

func (dict *ConcurrentDict) PutIfExists(key string, val interface{}) (result int)

return the number of updated key-value

func (*ConcurrentDict) RandomDistinctKeys

func (dict *ConcurrentDict) RandomDistinctKeys(limit int) []string

func (*ConcurrentDict) RandomKeys

func (dict *ConcurrentDict) RandomKeys(limit int) []string

func (*ConcurrentDict) Remove

func (dict *ConcurrentDict) Remove(key string) (result int)

return the number of deleted key-value

type Consumer

type Consumer func(key string, val interface{}) bool

type Dict

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) (result int)
	ForEach(consumer Consumer)
	Keys() []string
	RandomKeys(limit int) []string
	RandomDistinctKeys(limit int) []string
}

type Shard

type Shard struct {
	// contains filtered or unexported fields
}

func (*Shard) RandomKey

func (shard *Shard) RandomKey() string

type SimpleDict

type SimpleDict struct {
	// contains filtered or unexported fields
}

func MakeSimple

func MakeSimple() *SimpleDict

func (*SimpleDict) ForEach

func (dict *SimpleDict) ForEach(consumer Consumer)

func (*SimpleDict) Get

func (dict *SimpleDict) Get(key string) (val interface{}, exists bool)

func (*SimpleDict) Keys

func (dict *SimpleDict) Keys() []string

func (*SimpleDict) Len

func (dict *SimpleDict) Len() int

func (*SimpleDict) Put

func (dict *SimpleDict) Put(key string, val interface{}) (result int)

func (*SimpleDict) PutIfAbsent

func (dict *SimpleDict) PutIfAbsent(key string, val interface{}) (result int)

func (*SimpleDict) PutIfExists

func (dict *SimpleDict) PutIfExists(key string, val interface{}) (result int)

func (*SimpleDict) RandomDistinctKeys

func (dict *SimpleDict) RandomDistinctKeys(limit int) []string

func (*SimpleDict) RandomKeys

func (dict *SimpleDict) RandomKeys(limit int) []string

func (*SimpleDict) Remove

func (dict *SimpleDict) Remove(key string) (result int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL