memutils

package
v0.0.0-...-10a0d72 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Now

func Now() int64

func Zero

func Zero[T any]() T

Types

type MemDriver

type MemDriver[T any] interface {
	Init(kargs ...string)

	Read(key string) (T, bool)
	Write(key string, value T, expire time.Duration, overwriteTTLIfExists bool) T
	IncBy(key string, value int, expire time.Duration, overwriteTTLIfExists bool) int
	Inc(key string, expire time.Duration, overwriteTTLIfExists bool) int

	List(prefix string) []string
	Expire(key string)
	SetExpire(key string, duration time.Duration) time.Duration
	Exists(key string) bool
	Wipe(prefix string)
	WipePrefix(prefix string)
}

type MemDriverMemory

type MemDriverMemory[T comparable] struct {
	MemDriver[T]
	// contains filtered or unexported fields
}

func (*MemDriverMemory[T]) Exists

func (md *MemDriverMemory[T]) Exists(key string) bool

func (*MemDriverMemory[T]) Expire

func (md *MemDriverMemory[T]) Expire(key string)

func (*MemDriverMemory[T]) Inc

func (md *MemDriverMemory[T]) Inc(key string, expire time.Duration, overwriteTTLIfExists bool) int

func (*MemDriverMemory[T]) IncBy

func (md *MemDriverMemory[T]) IncBy(key string, value int, expire time.Duration, overwriteTTLIfExists bool) int

func (*MemDriverMemory[T]) Init

func (md *MemDriverMemory[T]) Init(kargs ...string)

func (*MemDriverMemory[T]) List

func (md *MemDriverMemory[T]) List(key string) []string

func (*MemDriverMemory[T]) Read

func (md *MemDriverMemory[T]) Read(key string) (T, bool)

func (*MemDriverMemory[T]) SetExpire

func (md *MemDriverMemory[T]) SetExpire(key string, duration time.Duration) time.Duration

func (*MemDriverMemory[T]) Wipe

func (md *MemDriverMemory[T]) Wipe(prefix string)

func (*MemDriverMemory[T]) WipePrefix

func (md *MemDriverMemory[T]) WipePrefix(prefix string)

func (*MemDriverMemory[T]) Write

func (md *MemDriverMemory[T]) Write(key string, value T, expire time.Duration, overwriteTTLIfExists bool) T

Jump to

Keyboard shortcuts

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