Documentation ¶
Overview ¶
package cache provides functions for saving IIIF files to supported locations, including disk, memory, blob, and Amazon S3.
Index ¶
- type BlobCache
- type Cache
- func NewBlobCache(config iiifconfig.CacheConfig) (Cache, error)
- func NewBlobCacheFromURI(uri string) (Cache, error)
- func NewCacheFromConfig(config iiifconfig.CacheConfig) (Cache, error)
- func NewDerivativesCacheFromConfig(config *iiifconfig.Config) (Cache, error)
- func NewDiskCache(cfg config.CacheConfig) (Cache, error)
- func NewImagesCacheFromConfig(config *iiifconfig.Config) (Cache, error)
- func NewS3Cache(cfg iiifconfig.CacheConfig) (Cache, error)
- type MemoryCache
- type NullCache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlobCache ¶
type BlobCache struct { Cache // contains filtered or unexported fields }
A BlobCache is a Cache that includes attributes specific to a blob such as the bucket_uri and acl configuration.
type Cache ¶
type Cache interface { Exists(string) bool Get(string) ([]byte, error) Set(string, []byte) error Unset(string) error }
A Cache is a representation of a cache location.
func NewBlobCache ¶
func NewBlobCache(config iiifconfig.CacheConfig) (Cache, error)
NewBlobCache returns a NewBlobCacheFromURI.
func NewBlobCacheFromURI ¶
NewBlobCacheFromURI returns a BlobCache using the GoCloud package.
func NewCacheFromConfig ¶
func NewCacheFromConfig(config iiifconfig.CacheConfig) (Cache, error)
NewCacheFromConfig returns a Cache object depending on the type of cache requested. Cache types can be blob, disk, memory, s3 or s3blob.
func NewDerivativesCacheFromConfig ¶
func NewDerivativesCacheFromConfig(config *iiifconfig.Config) (Cache, error)
NewDerivativesCacheFromConfig returns a NewCacheFromConfig.
func NewDiskCache ¶
func NewDiskCache(cfg config.CacheConfig) (Cache, error)
NewDiskCache returns a NewBlobCacheFromURI for a local files system location.
func NewImagesCacheFromConfig ¶
func NewImagesCacheFromConfig(config *iiifconfig.Config) (Cache, error)
NewImagesCacheFromConfig returns a NewCacheFromConfig.
func NewS3Cache ¶
func NewS3Cache(cfg iiifconfig.CacheConfig) (Cache, error)
NewS3Cache returns a NewBlobCacheFromURI with a constructed blob uri.
type MemoryCache ¶
type MemoryCache struct { Cache // contains filtered or unexported fields }
A MemoryCache represents a cache location in memory.
func NewMemoryCache ¶
func NewMemoryCache(cfg iiifconfig.CacheConfig) (*MemoryCache, error)
NewMemoryCache returns a pointer to a MemoryCache
func (*MemoryCache) Exists ¶
func (mc *MemoryCache) Exists(key string) bool
Exists returns a bool set to true if the configured memory location exists.
func (*MemoryCache) Get ¶
func (mc *MemoryCache) Get(key string) ([]byte, error)
Get reads data from a memory location.
func (*MemoryCache) OnEvicted ¶
func (mc *MemoryCache) OnEvicted(key string, value interface{})
func (*MemoryCache) Set ¶
func (mc *MemoryCache) Set(key string, data []byte) error
Set writes data to a memory location.
func (*MemoryCache) Unset ¶
func (mc *MemoryCache) Unset(key string) error
Unset deletes data from a memory location.
type NullCache ¶
type NullCache struct {
Cache
}
A NullCache represents a Cache.
func NewNullCache ¶
func NewNullCache(cfg config.CacheConfig) (*NullCache, error)
NewNullCache returns a pointer to a NullCache.