Documentation ¶
Index ¶
- Constants
- Variables
- type BitMap
- func (bm *BitMap) Add(num uint32) bool
- func (bm *BitMap) AddRange(start uint32, end uint32) *BitMap
- func (bm *BitMap) Contains(num uint32) bool
- func (bm *BitMap) Copy() *BitMap
- func (bm *BitMap) Difference(t *BitMap, inplace ...bool) *BitMap
- func (bm *BitMap) Equal(t *BitMap) bool
- func (bm *BitMap) Intersect(target *BitMap, inplace ...bool) *BitMap
- func (bm *BitMap) Len() int
- func (bm *BitMap) MarshalJSON() ([]byte, error)
- func (bm *BitMap) Max() int
- func (bm *BitMap) Min() int
- func (bm *BitMap) Range(f func(uint32) bool)
- func (bm *BitMap) Remove(num uint32) bool
- func (bm *BitMap) RevRange(f func(uint32) bool)
- func (bm *BitMap) Union(t *BitMap, inplace ...bool) *BitMap
- func (bm *BitMap) UnmarshalJSON(src []byte) error
- type Bloom
- type Cache
- func (c *Cache[K, V]) Clear()
- func (c *Cache[K, V]) Get(key K) (v V, ok bool)
- func (c *Cache[K, V]) Keys() []K
- func (c *Cache[K, V]) Len() int
- func (c *Cache[K, V]) MSet(values map[K]V, ttl ...time.Duration)
- func (c *Cache[K, V]) MarshalJSON() ([]byte, error)
- func (c *Cache[K, V]) OnExpired(f cmap.RemoveCb[K, *cacheItem[V]]) *Cache[K, V]
- func (c *Cache[K, V]) Print()
- func (c *Cache[K, V]) Range(f func(key K, value V) bool)
- func (c *Cache[K, V]) RangeWithTTL(f func(key K, value V, ttl int64) bool)
- func (c *Cache[K, V]) Remove(key K)
- func (c *Cache[K, V]) Set(key K, value V, ttl ...time.Duration)
- func (c *Cache[K, V]) SetTTL(key K, ttl time.Duration) bool
- func (c *Cache[K, V]) UnmarshalJSON(src []byte) error
- type LSet
- func (s *LSet[T]) Add(key T) bool
- func (s LSet) Bottom(i int)
- func (s LSet) Capacity() int
- func (s *LSet[T]) Copy() *LSet[T]
- func (s *LSet[T]) Difference(t *LSet[T]) *LSet[T]
- func (s *LSet[T]) Equal(t *LSet[T]) bool
- func (s *LSet[T]) Exist(key T) bool
- func (s LSet) Find(elem T) int
- func (s LSet) Index(i int) T
- func (s *LSet[T]) Intersect(t *LSet[T]) *LSet[T]
- func (s *LSet[T]) IsSubSet(t *LSet[T]) bool
- func (s *LSet[T]) LPop() (key T, ok bool)
- func (s LSet) LShift()
- func (s LSet) Len() int
- func (s LSet) Print()
- func (s *LSet[T]) RPop() (key T, ok bool)
- func (s LSet) RShift()
- func (s *LSet[T]) RandomPop() (key T, ok bool)
- func (s LSet) Range(f func(T) bool)
- func (s *LSet[T]) Remove(key T) bool
- func (s LSet) Reverse()
- func (s LSet) Swap(i, j int)
- func (s LSet) Top(i int)
- func (s *LSet[T]) Union(t *LSet[T]) *LSet[T]
- func (s *LSet[T]) UnmarshalJSON(src []byte) error
- func (s LSet) Values() []T
- type List
- func (s List) Bottom(i int)
- func (s List) Capacity() int
- func (s *List[T]) Clip()
- func (s *List[T]) Compact()
- func (s List) Copy() array[T]
- func (ls *List[T]) Filter(f func(T) bool) *List[T]
- func (s List) Find(elem T) int
- func (s List) Index(i int) T
- func (ls *List[T]) Insert(i int, values ...T)
- func (ls *List[T]) IsSorted(f func(T, T) bool) bool
- func (ls *List[T]) LPop() (val T, ok bool)
- func (ls *List[T]) LPush(values ...T)
- func (s List) LShift()
- func (s List) Len() int
- func (s *List[T]) MarshalJSON() ([]byte, error)
- func (ls *List[T]) Max(less func(T, T) bool) T
- func (ls *List[T]) Mean(f func(T) float64) float64
- func (ls *List[T]) Min(less func(T, T) bool) T
- func (s List) Print()
- func (ls *List[T]) RPop() (val T, ok bool)
- func (ls *List[T]) RPush(values ...T)
- func (s List) RShift()
- func (s List) Range(f func(T) bool)
- func (ls *List[T]) RemoveFirst(elem T) bool
- func (ls *List[T]) RemoveIndex(i int) bool
- func (s List) Reverse()
- func (ls *List[T]) Sort(f func(T, T) bool) *List[T]
- func (ls *List[T]) Sum(f func(T) float64) float64
- func (s List) Swap(i, j int)
- func (s List) Top(i int)
- func (s *List[T]) UnmarshalJSON(src []byte) error
- func (s List) Values() []T
- type Map
- func (m Map[K, V]) Clear()
- func (m Map[K, V]) Copy() Map[K, V]
- func (m Map[K, V]) Delete(key K) error
- func (m Map[K, V]) Exist(key K) bool
- func (m Map[K, V]) Get(key K) (V, bool)
- func (m Map[K, V]) Keys() []K
- func (m Map[K, V]) Len() int
- func (m Map[K, V]) MarshalJSON() ([]byte, error)
- func (m Map[K, V]) Range(f func(K, V) bool)
- func (m Map[K, V]) Set(key K, value V)
- func (m Map[K, V]) UnmarshalJSON(src []byte) error
- func (m Map[K, V]) Values() []V
- type Pool
- type Skiplist
- func (s *Skiplist[K, V]) Add(key K, value V) *skiplistNode[K, V]
- func (s *Skiplist[K, V]) Delete(key K, value V) bool
- func (s *Skiplist[K, V]) Find(value V) bool
- func (s *Skiplist[K, V]) GetByRank(rank int) (k K, v V, err error)
- func (s *Skiplist[K, V]) GetScoreWithRank(key K) (v V, rank int, err error)
- func (s *Skiplist[K, V]) Len() int
- func (s *Skiplist[K, V]) Print()
- func (s *Skiplist[K, V]) Range(start, end int, f func(K, V) bool)
- func (s *Skiplist[K, V]) RangeByScores(min, max V, f func(K, V) bool)
- type SyncMap
- type Trie
- type ZSet
- func (z *ZSet[K, V]) Copy() *ZSet[K, V]
- func (z *ZSet[K, V]) Delete(keys ...K) error
- func (z *ZSet[K, V]) GetByRank(rank int) (k K, v V, err error)
- func (z *ZSet[K, V]) GetScore(key K) (v V, err error)
- func (z *ZSet[K, V]) GetScoreWithRank(key K) (V, int, error)
- func (z *ZSet[K, V]) Incr(key K, value V) V
- func (z *ZSet[K, V]) Len() int
- func (z *ZSet[K, V]) Print()
- func (z *ZSet[K, V]) Range(start, end int, f func(K, V) bool)
- func (z *ZSet[K, V]) RangeByScores(min, max V, f func(K, V) bool)
- func (z *ZSet[K, V]) Set(key K, value V)
- func (z *ZSet[K, V]) Union(target *ZSet[K, V])
Constants ¶
const (
NoTTL int64 = math.MaxInt64
)
Variables ¶
var ( // duration of expired keys evictions GCDuration = time.Minute // duration of update current timestamp TickerDuration = time.Millisecond // default expiry time DefaultTTL = time.Minute * 10 )
Functions ¶
This section is empty.
Types ¶
type BitMap ¶ added in v0.2.6
type BitMap struct {
// contains filtered or unexported fields
}
func (*BitMap) Add ¶ added in v0.3.0
Add If you use numbers that increment from 0, the bitmap performance will be very good.
func (*BitMap) Difference ¶ added in v0.4.2
Difference
func (*BitMap) MarshalJSON ¶ added in v0.5.0
func (*BitMap) UnmarshalJSON ¶ added in v0.5.0
type Cache ¶ added in v0.1.7
func (*Cache[K, V]) MarshalJSON ¶ added in v0.5.0
func (*Cache[K, V]) RangeWithTTL ¶ added in v0.1.7
RangeWithTTL
func (*Cache[K, V]) UnmarshalJSON ¶ added in v0.5.0
type LSet ¶ added in v0.1.4
type LSet[T comparable] struct { *List[T] // contains filtered or unexported fields }
LSet (ListSet): map + list structure LSet has richer api and faster Intersect, Union, Range operations than mapset
func NewLSet ¶ added in v0.1.4
func NewLSet[T comparable](values ...T) *LSet[T]
NewLSet: Create a new LSet
func (*LSet[T]) Difference ¶ added in v0.1.5
Difference
func (LSet) LShift ¶ added in v0.2.1
func (s LSet) LShift()
LShift: Shift all elements of the array left exp: [1, 2, 3] => [2, 3, 1]
func (LSet) RShift ¶ added in v0.2.1
func (s LSet) RShift()
RShift: Shift all elements of the array right exp: [1, 2, 3] => [3, 1, 2]
func (*LSet[T]) UnmarshalJSON ¶ added in v0.2.2
type List ¶
type List[T comparable] struct { // contains filtered or unexported fields }
func (*List[T]) Clip ¶ added in v0.6.0
func (s *List[T]) Clip()
Clip removes unused capacity from the slice.
func (*List[T]) Compact ¶ added in v0.6.0
func (s *List[T]) Compact()
Compact replaces consecutive runs of equal elements with a single copy.
func (List) LShift ¶ added in v0.2.0
func (s List) LShift()
LShift: Shift all elements of the array left exp: [1, 2, 3] => [2, 3, 1]
func (*List[T]) MarshalJSON ¶ added in v0.2.1
func (List) RShift ¶ added in v0.2.0
func (s List) RShift()
RShift: Shift all elements of the array right exp: [1, 2, 3] => [3, 1, 2]
func (*List[T]) RemoveFirst ¶ added in v0.5.0
RemoveFirst
func (*List[T]) RemoveIndex ¶ added in v0.6.0
RemoveIndex
func (*List[T]) UnmarshalJSON ¶ added in v0.2.2
type Map ¶
type Map[K comparable, V any] map[K]V
func (Map[K, V]) MarshalJSON ¶ added in v0.6.0
func (Map[K, V]) UnmarshalJSON ¶ added in v0.6.0
type Skiplist ¶ added in v0.1.7
func (*Skiplist[K, V]) Add ¶ added in v0.1.7
func (s *Skiplist[K, V]) Add(key K, value V) *skiplistNode[K, V]
Add
func (*Skiplist[K, V]) GetScoreWithRank ¶ added in v0.1.7
GetScoreWithRank: Get the score and rank by key
func (*Skiplist[K, V]) RangeByScores ¶ added in v0.1.7
RangeByScores
type SyncMap ¶
type SyncMap[K comparable, V any] struct { cmap.ConcurrentMap[K, V] }
SynMap: use ConcurrentMap
func NewSyncMapStringer ¶ added in v0.4.0
NewSyncMapStringer
func (*SyncMap[K, V]) MarshalJSON ¶ added in v0.5.0
MarshalJSON
func (*SyncMap[K, V]) UnmarshalJSON ¶ added in v0.5.0
UnmarshalJSON
type Trie ¶ added in v0.3.0
func (*Trie[T]) MarshalJSON ¶ added in v0.6.1
func (*Trie[T]) UnmarshalJSON ¶ added in v0.6.1
type ZSet ¶ added in v0.1.3
func (*ZSet[K, V]) GetScoreWithRank ¶ added in v0.1.7
GetScoreWithRank
func (*ZSet[K, V]) Incr ¶ added in v0.1.7
func (z *ZSet[K, V]) Incr(key K, value V) V
Incr: Increment value by key
func (*ZSet[K, V]) RangeByScores ¶ added in v0.1.7
RangeByScores