Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { Get(key string, parameters imageserver.Parameters) (*imageserver.Image, error) Set(key string, image *imageserver.Image, parameters imageserver.Parameters) error }
Cache represents an Image cache
The Get() method must return a CacheMissError if it is a cache related problem.
The "parameters" argument can be used for custom behavior (no-cache, expiration, ...)
type CacheImageServer ¶
type CacheImageServer struct { ImageServer imageserver.ImageServerInterface Cache KeyGenerator }
CacheImageServer represents an Image server with Cache
It wraps an ImageServer.
func (*CacheImageServer) Get ¶
func (cis *CacheImageServer) Get(parameters imageserver.Parameters) (*imageserver.Image, error)
Get wraps the call to the underlying ImageServer and Get from/Set to the Cache
type CacheMissError ¶
CacheMissError represents a cache miss error (no image found or cache not available)
func NewCacheMissError ¶
func NewCacheMissError(key string, cache Cache, previous error) *CacheMissError
NewCacheMissError creates a new CacheMissError
func (*CacheMissError) Error ¶
func (err *CacheMissError) Error() string
type KeyGenerator ¶
type KeyGenerator interface {
GetKey(imageserver.Parameters) string
}
KeyGenerator generates a Cache key
type KeyGeneratorFunc ¶
type KeyGeneratorFunc func(imageserver.Parameters) string
KeyGeneratorFunc is a KeyGenerator func
func NewParametersHashKeyGeneratorFunc ¶
func NewParametersHashKeyGeneratorFunc(newHashFunc func() hash.Hash) KeyGeneratorFunc
NewParametersHashKeyGeneratorFunc returns a KeyGeneratorFunc that hashes the Parameters
func (KeyGeneratorFunc) GetKey ¶
func (f KeyGeneratorFunc) GetKey(parameters imageserver.Parameters) string
GetKey calls the func
Directories ¶
Path | Synopsis |
---|---|
Package _test provides utilities for cache testing
|
Package _test provides utilities for cache testing |
Package async provides an asynchronous cache
|
Package async provides an asynchronous cache |
Package list provides a list of Image Cache
|
Package list provides a list of Image Cache |
Package memcache provides a Memcache Image Cache
|
Package memcache provides a Memcache Image Cache |
Package memory provides an in-memory Image Cache
|
Package memory provides an in-memory Image Cache |
Package redis provides a Redis Image Cache
|
Package redis provides a Redis Image Cache |