cache

package
Version: v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package cache defines the Trickster cache interfaces and provides general cache functionality

Index

Constants

This section is empty.

Variables

View Source
var ErrKNF = errors.New("key not found in cache")

ErrKNF represents the error "key not found in cache"

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Connect() error
	Store(cacheKey string, data []byte, ttl time.Duration) error
	Retrieve(cacheKey string, allowExpired bool) ([]byte, status.LookupStatus, error)
	SetTTL(cacheKey string, ttl time.Duration)
	Remove(cacheKey string)
	BulkRemove(cacheKeys []string)
	Close() error
	Configuration() *options.Options
	Locker() locks.NamedLocker
	SetLocker(locks.NamedLocker)
}

Cache is the interface for the supported caching fabrics When making new cache types, Retrieve() must return an error on cache miss

type MemoryCache

type MemoryCache interface {
	Connect() error
	Store(cacheKey string, data []byte, ttl time.Duration) error
	Retrieve(cacheKey string, allowExpired bool) ([]byte, status.LookupStatus, error)
	SetTTL(cacheKey string, ttl time.Duration)
	Remove(cacheKey string)
	BulkRemove(cacheKeys []string)
	Close() error
	Configuration() *options.Options
	StoreReference(cacheKey string, data ReferenceObject, ttl time.Duration) error
	RetrieveReference(cacheKey string, allowExpired bool) (interface{}, status.LookupStatus, error)
	Locker() locks.NamedLocker
	SetLocker(locks.NamedLocker)
}

MemoryCache is the interface for an in-memory cache This offers an additional method for storing references to bypass serialization

type ReferenceObject

type ReferenceObject interface {
	Size() int
}

ReferenceObject defines an interface for a cache object possessing the ability to report the approximate comprehensive byte size of its members, to assist with cache size management

Source Files

Directories

Path Synopsis
Package badger is the BadgerDB implementation of the Trickster Cache
Package badger is the BadgerDB implementation of the Trickster Cache
Package bbolt is the bbolt implementation of the Trickster Cache
Package bbolt is the bbolt implementation of the Trickster Cache
Package filesystem is the filesystem implementation of the Trickster Cache
Package filesystem is the filesystem implementation of the Trickster Cache
Package index defines the Trickster Cache Index
Package index defines the Trickster Cache Index
Package memory is the memory implementation of the Trickster Cache and uses a sync.Map to manage cache objects
Package memory is the memory implementation of the Trickster Cache and uses a sync.Map to manage cache objects
Package redis is the redis implementation of the Trickster Cache and supports Standalone, Sentinel and Cluster
Package redis is the redis implementation of the Trickster Cache and supports Standalone, Sentinel and Cluster
Package registration handles the registration of cache implementations to be used by proxy cache handlers
Package registration handles the registration of cache implementations to be used by proxy cache handlers
Package status governs the possible Cache Lookup Status values
Package status governs the possible Cache Lookup Status values

Jump to

Keyboard shortcuts

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