file

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2020 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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