cache

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2022 License: Apache-2.0 Imports: 2 Imported by: 3 modules, 5 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultOnExpire

func DefaultOnExpire(d interface{})

Types

type Cache

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

func NewCache

func NewCache() *Cache

func (*Cache) CheckExpirations

func (c *Cache) CheckExpirations(now time.Time)

func (*Cache) Delete

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

func (*Cache) Load

func (c *Cache) Load(key interface{}) (actual *Element)

func (*Cache) LoadOrStore

func (c *Cache) LoadOrStore(key interface{}, e *Element) (actual *Element, loaded bool)

func (*Cache) PullOutAll

func (c *Cache) PullOutAll() map[interface{}]interface{}

type Element

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

func NewElement

func NewElement(data interface{}, validUntil time.Time, onExpire func(d interface{})) *Element

func (*Element) Data

func (e *Element) Data() interface{}

func (*Element) IsExpired

func (e *Element) IsExpired(now time.Time) bool

Jump to

Keyboard shortcuts

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