esicache

package
v0.0.0-...-8dcffa4 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2019 License: Apache-2.0 Imports: 4 Imported by: 5

Documentation

Overview

Package esicache provides integrations for cache services which store content from backend resources.

Index

Constants

This section is empty.

Variables

View Source
var MainRegistry = &registry{
	caches: make(map[string]Caches),
}

MainRegistry global cache registry

Functions

This section is empty.

Types

type Cacher

type Cacher interface {
	Set(key string, value []byte, expiration time.Duration) error
	Get(key string) ([]byte, error)
}

Cacher used to cache the response of a micro service as found in the src attribute of an ESI tag. But the Cacher gets only involved if the additional attribute ttl has been set for each ESI tag. A Cacher must be thread safe.

func NewCacher

func NewCacher(url string) (Cacher, error)

NewCacher creates a new cache service object and its connection as defined by its URL.

type Caches

type Caches []Cacher

Caches gets set during config reading and implements Cacher interface

func (Caches) Get

func (c Caches) Get(key string) ([]byte, error)

Get fetches from the cache service

func (Caches) Set

func (c Caches) Set(key string, value []byte, expiration time.Duration) error

Set writes to the cache service

Jump to

Keyboard shortcuts

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