cache

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(cacheType string, init InitFunc) error

Register is called by the init functions of the cache.

func Registered added in v0.6.1

func Registered() (c []string)

Registered returns the caché's that have been registered.

Types

type ErrGettingFromCache added in v0.5.0

type ErrGettingFromCache struct {
	Err       error
	CacheType string
}

func (ErrGettingFromCache) Error added in v0.5.0

func (e ErrGettingFromCache) Error() string

type ErrInvalidFileKey

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

func (ErrInvalidFileKey) Error

func (e ErrInvalidFileKey) Error() string

type ErrInvalidFileKeyParts

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

func (ErrInvalidFileKeyParts) Error

func (e ErrInvalidFileKeyParts) Error() string

type ErrPurgingCache added in v0.5.0

type ErrPurgingCache struct {
	Err       error
	CacheType string
}

func (ErrPurgingCache) Error added in v0.5.0

func (e ErrPurgingCache) Error() string

type ErrSettingToCache added in v0.5.0

type ErrSettingToCache struct {
	Err       error
	CacheType string
}

func (ErrSettingToCache) Error added in v0.5.0

func (e ErrSettingToCache) Error() string

type InitFunc

type InitFunc func(dict.Dicter) (Interface, error)

InitFunc initilize a cache given a config map. The InitFunc should validate the config map, and report any errors. This is called by the For function.

type Interface

type Interface interface {
	Get(key *Key) (val []byte, hit bool, err error)
	Set(key *Key, val []byte) error
	Purge(key *Key) error
}

Interface defines a cache back end

func For

func For(cacheType string, config dict.Dicter) (Interface, error)

For function returns a configed cache of the given type, provided the correct config map.

type Key

type Key struct {
	MapName   string
	LayerName string
	Z         uint
	X         uint
	Y         uint
}

func ParseKey

func ParseKey(str string) (*Key, error)

ParseKey will parse a string in the format /:map/:layer/:z/:x/:y into a Key struct. The :layer value is optional ParseKey also supports other OS delimeters (i.e. Windows - "\")

func (Key) String

func (k Key) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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