cache

package
v0.0.0-...-2d52d2e Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorCacheKeyNotFound = errors.New("Cache Key Not Found")

ErrorCacheKeyNotFound is foobar

Functions

This section is empty.

Types

type Cache

type Cache struct {
	Providers []Provider
}

Cache is foobar

func (Cache) Delete

func (c Cache) Delete(key string) error

Delete the CacheItem in all of the providers

func (Cache) Get

func (c Cache) Get(key string) (Item, error)

Get the first CacheItem found by a provider

func (Cache) Has

func (c Cache) Has(key string) (bool, error)

Has will return true if any of the providers have the key

func (Cache) Set

func (c Cache) Set(item Item) (Item, error)

Set the CacheItem in all of the providers

type Item

type Item struct {
	Key       string
	Value     []byte
	ExpiresAt *time.Time
}

Item is foobar

type Provider

type Provider interface {
	Get(key string) (Item, error)
	Set(item Item) (Item, error)
	Delete(key string) error
	Has(key string) (bool, error)
}

Provider is foobar

type ProviderJSON

type ProviderJSON struct {
	Path          string
	HashFilenames bool
}

ProviderJSON is foobar

func (ProviderJSON) Delete

func (p ProviderJSON) Delete(key string) error

Delete is foobar

func (ProviderJSON) Get

func (p ProviderJSON) Get(key string) (Item, error)

Get is foobar

func (ProviderJSON) Has

func (p ProviderJSON) Has(key string) (bool, error)

Has is foobar

func (ProviderJSON) Set

func (p ProviderJSON) Set(item Item) (Item, error)

Set is foobar

type ProviderMemory

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

ProviderMemory is foobar

func (*ProviderMemory) Delete

func (p *ProviderMemory) Delete(key string) error

Delete is foobar

func (*ProviderMemory) Get

func (p *ProviderMemory) Get(key string) (Item, error)

Get is foobar

func (*ProviderMemory) Has

func (p *ProviderMemory) Has(key string) (bool, error)

Has is foobar

func (*ProviderMemory) Set

func (p *ProviderMemory) Set(item Item) (Item, error)

Set is foobar

Jump to

Keyboard shortcuts

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