cache

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TTL

type TTL struct {
	sync.Mutex
	// contains filtered or unexported fields
}

TTL implements a simple TTLed cache. It is concurrency safe.

func NewTTL

func NewTTL(ttl time.Duration, maxTTL time.Duration) *TTL

NewTTL creates a new TTLed cache.

func (*TTL) Get

func (c *TTL) Get(key string) (string, bool)

Get retrieves a single entry, extending it's TTL.

func (*TTL) Purge

func (c *TTL) Purge()

Purge removes all entries from the cache.

func (*TTL) Remove

func (c *TTL) Remove(key string)

Remove removes a single entry from the cache.

func (*TTL) Set

func (c *TTL) Set(key, value string)

Set creates or overwrites an entry.

Jump to

Keyboard shortcuts

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