caching

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: Apache-2.0, MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GroupedSet

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

func NewGroupedSet

func NewGroupedSet(maxGroups, maxSetSize int) *GroupedSet

func (*GroupedSet) Add

func (gs *GroupedSet) Add(g uint64, namespace, v []byte) (bool, error)

Add attempts to add the given value for the given group if not already present.

func (*GroupedSet) Contains

func (gs *GroupedSet) Contains(g uint64, namespace, v []byte) (bool, error)

Contains checks if the given value at given group is present, and if so updates its recency. Otherwise, returns false.

func (*GroupedSet) RemoveGroupsLessThan

func (gs *GroupedSet) RemoveGroupsLessThan(group uint64) bool

type Set

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

func NewSet

func NewSet(maxSize int) *Set

NewSet creates a new Set with a specified max size per sample subset. The max size cannot be less than 1; if it is the cache will silently be instantiated with max size of 1.

func (*Set) Clear

func (ss *Set) Clear()

Clear removes all elements in the set.

func (*Set) Contains

func (ss *Set) Contains(namespace, v []byte) (bool, error)

Contains checks if the given sample v is contained within sample set. A namespace may optionally be specified for the value. Namespace must be between 0 to 64 bytes long.

func (*Set) ContainsOrAdd

func (ss *Set) ContainsOrAdd(namespace, v []byte) (bool, error)

ContainsOrAdd checks if the given sample v is contained within sample set, and if not adds it. The namespace may be optionally supplied; it must be between zero to 64 bytes.

Jump to

Keyboard shortcuts

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