cache

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2017 License: MIT Imports: 5 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.

Types

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 InitFunc

type InitFunc func(map[string]interface{}) (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 map[string]interface{}) (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         int
	X         int
	Y         int
}

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