ttlpool

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

type Pool[T interface{}] struct {
	// contains filtered or unexported fields
}

func NewPool

func NewPool[T interface{}]() *Pool[T]

func (*Pool[T]) Delete

func (p *Pool[T]) Delete(key string)

func (*Pool[T]) Get

func (p *Pool[T]) Get(key string) (T, bool)

func (*Pool[T]) Set

func (p *Pool[T]) Set(key string, value T, ttl time.Duration)

func (*Pool[T]) Update

func (p *Pool[T]) Update(key string, fun func(t T) (T, time.Duration))

type TtlValue

type TtlValue[T interface{}] struct {
	Value    T
	ExpireAt time.Time
}

Jump to

Keyboard shortcuts

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