redis

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: 6 Imported by: 0

README

RedisCache

This package implements tegola's cache interface for use with Redis. If a redis instance is running locally with default configurations solely for tegola simply include the following snippet in tegola's config file:

[cache]
type="redis"

Properties

The rediscache config supports the following properties:

  • network (string): [Optional] Network type, either tcp or unix. Defaults to 'tcp'.
  • address (string): [Optional] the address of the Redis instance in form of ip:port. Defaults to '127.0.0.1:6379'.
  • password (string): [Optional] password for the Redis instance. Defaults to '' (no password).
  • db (int): [Optional] the database within the Redis instance to cache to.
  • max_zoom (int): [Optional] the max zoom the cache should cache to. After this zoom, Set() calls will return before doing work.
  • ttl (int): [Optional] the key ttl time in seconds. Defaults to 0 (the key has no expiration time).

Documentation

Index

Constants

View Source
const (
	ConfigKeyNetwork  = "network"
	ConfigKeyAddress  = "address"
	ConfigKeyPassword = "password"
	ConfigKeyDB       = "db"
	ConfigKeyMaxZoom  = "max_zoom"
	ConfigKeyTTL      = "ttl"
)
View Source
const CacheType = "redis"

Variables

This section is empty.

Functions

func New

func New(config dict.Dicter) (rcache cache.Interface, err error)

Types

type RedisCache

type RedisCache struct {
	Redis      *redis.Client
	Expiration time.Duration
	MaxZoom    uint
}

func (*RedisCache) Get

func (rdc *RedisCache) Get(key *cache.Key) (val []byte, hit bool, err error)

func (*RedisCache) Purge

func (rdc *RedisCache) Purge(key *cache.Key) (err error)

func (*RedisCache) Set

func (rdc *RedisCache) 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