cache

package
v0.0.0-...-1bf96ee Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2022 License: AGPL-3.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 Cache

type Cache struct {
	Lock  sync.RWMutex
	TTL   time.Duration
	Items map[string]*Item
}

func NewCache

func NewCache(ttl time.Duration) *Cache

func (*Cache) Clear

func (c *Cache) Clear()

func (*Cache) Delete

func (c *Cache) Delete(key string) interface{}

func (*Cache) Get

func (c *Cache) Get(key string) interface{}

func (*Cache) GetAndSendData

func (c *Cache) GetAndSendData(key string, data string) bool

func (*Cache) Put

func (c *Cache) Put(key string, value interface{})

type Item

type Item struct {
	Value     interface{}
	Timestamp time.Time
}

func NewItem

func NewItem(v interface{}, t time.Time) *Item

Jump to

Keyboard shortcuts

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