medattlmap

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: MIT Imports: 2 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DEFAULT_TICKER_TTL time.Duration = 5 * time.Second
	DEFAULT_TTL        time.Duration = 5 * time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type TTLMap

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

func NewTTLMap

func NewTTLMap(ttl, tickttl time.Duration) *TTLMap

NewTTLMap creates a new TTLMap with the specified time-to-live if called with 0 and 0 then it's set to DEFAULT const above the tickttl is the value for "cron" checked, every tick we will check all the map for expiration

func (*TTLMap) Delete

func (t *TTLMap) Delete(key string)

Delete removes an item from the map.

func (*TTLMap) Get

func (t *TTLMap) Get(key string) (interface{}, bool)

Get retrieves an item from the map if it exists and is not expired.

func (*TTLMap) Len

func (t *TTLMap) Len() int

Get how many entries are in the ttlMap

func (*TTLMap) Map

func (t *TTLMap) Map() map[string]interface{}

Get how many entries are in the ttlMap

func (*TTLMap) Put

func (t *TTLMap) Put(key string, ttl time.Duration, value interface{})

Put adds or updates an item in the map with an expiration time.

func (*TTLMap) Stop

func (t *TTLMap) Stop()

Stop stops the cleanup goroutine.

Jump to

Keyboard shortcuts

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