filecache

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigKeyBasepath = "basepath"
	ConfigKeyMaxZoom  = "max_zoom"
)
View Source
const CacheType = "file"

Variables

View Source
var (
	ErrMissingBasepath = errors.New("filecache: missing required param 'basepath'")
)

Functions

func New

func New(config map[string]interface{}) (cache.Interface, error)

New instantiates a Filecache. The config expects the following params:

basepath (string): a path to where the cache will be written
max_zoom (int): max zoom to use the cache. beyond this zoom cache Set() calls will be ignored

Types

type Filecache

type Filecache struct {
	Basepath string
	//	MaxZoom determins the max zoom the cache to persist. Beyond this
	//	zoom, cache Set() calls will be ignored. This is useful if the cache
	//	should not be leveraged for higher zooms when data changes often.
	MaxZoom *uint
}

func (*Filecache) Get

func (fc *Filecache) Get(key *cache.Key) ([]byte, bool, error)

Get reads a z,x,y entry from the cache and returns the contents if there is a hit. the second argument denotes a hit or miss so the consumer does not need to sniff errors for cache read misses

func (*Filecache) Purge

func (fc *Filecache) Purge(key *cache.Key) error

func (*Filecache) Set

func (fc *Filecache) Set(key *cache.Key, val []byte) error

Jump to

Keyboard shortcuts

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