cache

package
v0.0.0-...-a8fda15 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2018 License: Apache-2.0 Imports: 8 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 {
	Get(key ...string) ([]byte, error)
	Set(data []byte, expire time.Duration, key ...string) error
	SetJSON(o interface{}, expire time.Duration, key ...string) error
	GetJSON(o interface{}, key ...string) error
	Clone() Cache
	Prefix(key ...string) Cache
}

Cache defines the interface to implement to handle acme results caching

type FileSystemCache

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

FileSystemCache is a cache that writes the content to the file system

func NewFileSystemCache

func NewFileSystemCache(path string) *FileSystemCache

NewFileSystemCache instanciates a cache backed on the file system

func (*FileSystemCache) Clone

func (c *FileSystemCache) Clone() Cache

Clone creates a copy of the cache accessor. With the same prefix the cloned copy will operate the same way as the original

func (*FileSystemCache) Get

func (c *FileSystemCache) Get(key ...string) ([]byte, error)

Get retrieves a cached value for a given key. It returns an error if the key is either expired or does not exist

func (*FileSystemCache) GetJSON

func (c *FileSystemCache) GetJSON(o interface{}, key ...string) error

GetJSON retrieves a cached value for a given key and decodes it from json. It returns an error if the key is either expired or does not exist

func (*FileSystemCache) Prefix

func (c *FileSystemCache) Prefix(p ...string) Cache

Prefix adds a common prefix to all cache access

func (*FileSystemCache) Set

func (c *FileSystemCache) Set(data []byte, expire time.Duration, key ...string) error

Set stores the data into the cache for a given key. the expiration will be evaluated at Get time.

func (*FileSystemCache) SetJSON

func (c *FileSystemCache) SetJSON(o interface{}, expire time.Duration, key ...string) error

SetJSON stores the an object into the cache for a given key after encoding it in json. the expiration will be evaluated at Get time.

type Noop

type Noop struct{}

func (*Noop) Clone

func (c *Noop) Clone() Cache

Clone creates a copy of the cache accessor. With the same prefix the cloned copy will operate the same way as the original

func (*Noop) Get

func (c *Noop) Get(key ...string) ([]byte, error)

Get retrieves a cached value for a given key. It returns an error if the key is either expired or does not exist

func (*Noop) GetJSON

func (c *Noop) GetJSON(o interface{}, key ...string) error

GetJSON retrieves a cached value for a given key and decodes it from json. It returns an error if the key is either expired or does not exist

func (*Noop) Prefix

func (c *Noop) Prefix(p ...string) Cache

Prefix adds a common prefix to all cache access

func (*Noop) Set

func (c *Noop) Set(data []byte, expire time.Duration, key ...string) error

Set stores the data into the cache for a given key. the expiration will be evaluated at Get time.

func (*Noop) SetJSON

func (c *Noop) SetJSON(o interface{}, expire time.Duration, key ...string) error

SetJSON stores the an object into the cache for a given key after encoding it in json. the expiration will be evaluated at Get time.

Jump to

Keyboard shortcuts

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