file

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2018 License: MIT Imports: 7 Imported by: 0

README

FileCache

filecache uses a file system for caching tiles. To use it, add the following minimum config to your tegola config file:

[cache]
type="file"
basepath="/tmp/tegola-cache"

Properties

The filecache config supports the following properties:

  • basepath (string): [Required] a location on the file system to write the cached tiles to.
  • max_zoom (int): [Optional] the max zoom the cache should cache to. After this zoom, Set() calls will return before doing work.

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 dict.Dicter) (cache.Interface, error)

New instantiates a Cache. 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 Cache

type Cache struct {
	Basepath string
	// MaxZoom determines 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 (*Cache) Get

func (fc *Cache) 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 (*Cache) Purge

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

func (*Cache) Set

func (fc *Cache) 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