cacheh

package module
v0.0.0-...-ae3d4cb Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2018 License: BSD-3-Clause Imports: 10 Imported by: 0

README

go-cacheh

Build Status

Very simple persistent caching layer for Go.

Currently only supports caching on the filesytem. A Cache is initialized pointing to a directory; each cache key goes in a file.

See godoc for package documentation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDirCacheDsn

func GetDirCacheDsn(dir string) string

func GetDirCacheWithGzipDsn

func GetDirCacheWithGzipDsn(dir string) string

Types

type Cache

type Cache interface {
	Get(key string) ([]byte, error) // returns nil if key not found
	Set(key string, value []byte) error
	Delete(key string) error // not an error if the key was not found

	WithKeyPrefix(keyPrefix string) Cache // get a Cache scoped to a key prefix
}

func NewCache

func NewCache(dsn string) (Cache, error)

NewCache constructs a new cache based on the dsn.

For example, file-based:

NewCache("dir:/home/$user/")

type ErrCacheInit

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

func (ErrCacheInit) Error

func (e ErrCacheInit) Error() string

type ErrCacheOperation

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

func (ErrCacheOperation) Error

func (e ErrCacheOperation) Error() string

type ErrUnsafeCacheKey

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

func (ErrUnsafeCacheKey) Error

func (e ErrUnsafeCacheKey) Error() string

Jump to

Keyboard shortcuts

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