store

package
v0.7.8 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExpiringStore

type ExpiringStore[T any] interface {
	// SetWithDuration adds the provided value with given key and duration to the store.
	// The stored value will be removed after the provided duration.
	SetWithDuration(key string, value *T, duration time.Duration)
	Store[T]
}

func NewDefaultTimedStore

func NewDefaultTimedStore[T any]() ExpiringStore[T]

func NewTimedStore

func NewTimedStore[T any](duration time.Duration) ExpiringStore[T]

type Set added in v0.7.8

type Set[T any] interface {
	Add(item *T)
	GetAll() []*T
	Remove(item *T)
	Clear()
	Contains(item *T) bool
	IsEmpty() bool
}

func NewSet added in v0.7.8

func NewSet[T any]() Set[T]

type Store

type Store[T any] interface {
	// Delete removes the stored struct related to given key.
	Delete(key string)
	// Set adds the provided value with given key to the store.
	Set(key string, value *T)
	// Get retrieves the value from the store by the given key.
	Get(key string) (*T, bool)
	// GetValues retrieves all values from the store.
	GetValues() []*T
}

func NewStore

func NewStore[T any]() Store[T]

type Timer

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

func NewTimer

func NewTimer() *Timer

Jump to

Keyboard shortcuts

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