cache

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package cache provides a simple ttl-based item cache

Index

Constants

View Source
const NoExpiration = gocache.NoExpiration

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	// Insert the string k
	Insert(k string, v string)
	// Exists proves the existence or lack-thereof of the item k in the cache
	Exists(k string) (exists bool)
	// Get returns the value of the key in the cache
	Get(k string) (value string, err error)
	// SetExpiration sets the expiration on the given item k without updating the value
	SetExpiration(k string, t time.Duration) error
}

Cache provides a simple item store

func NewCacheWithTTL

func NewCacheWithTTL(t time.Duration) Cache

NewCacheWithTTL creates a new cache with ttl of t

func NewCacheWithTTLFrom added in v1.0.0

func NewCacheWithTTLFrom(t time.Duration, defaultItems map[string]string) Cache

Jump to

Keyboard shortcuts

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