cache

package
v0.0.0-...-6af2dc9 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2021 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 Cache

type Cache interface {
	Stop()
	Store(key string, value interface{})
	Expire(key string, t time.Time)
	StoreExpiry(key string, value interface{}, expiry time.Time)
	Get(key string) (interface{}, bool)
	StoreOrGet(key string, value interface{}) (interface{}, bool)
	StoreOrGetExpire(key string, value interface{}, expiry time.Time) (interface{}, bool)
	Merge(item CacheItem) (interface{}, bool)
	Delete(key string)
	GetDelete(key string) (interface{}, bool)
	ItemsArray() []CacheItem
	Items() map[string]CacheItem
}

func New

func New(cleanup time.Duration, expire time.Duration) Cache

type CacheArray

type CacheArray interface {
	Stop()
	Store(key string, secondKey string, value interface{})
	StoreExpiry(key string, secondKey string, value interface{}, expiry time.Time)
	Get(key string) ([]interface{}, bool)
	GetFirst(key string) (interface{}, bool)
	Delete(key string, secondKey string)
	ItemsArray() []CacheArrayItem
	Items() map[string]CacheArrayItem
}

func NewArray

func NewArray(cleanup time.Duration, expire time.Duration) CacheArray

type CacheArrayItem

type CacheArrayItem struct {
	Key   string
	Items []CacheItem
	// contains filtered or unexported fields
}

func (CacheArrayItem) Expired

func (c CacheArrayItem) Expired() bool

type CacheItem

type CacheItem struct {
	Key    string
	Object interface{}
	Expiry time.Time
}

func (CacheItem) Expired

func (c CacheItem) Expired() bool

Jump to

Keyboard shortcuts

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