Documentation
¶
Overview ¶
package cache provides a storage-independent interface, and common implementations, for caching things. There are many interfaces for caching things. This one is ours. It reads and writes `io.ReadSeekCloser` instances.
Index ¶
- func GetString(ctx context.Context, c Cache, k string) (string, error)
- func IsCacheMiss(e error) bool
- func IsCacheMissMulti(e error) bool
- func ReadSeekCloserFromString(v string) (io.ReadSeekCloser, error)
- func RegisterCache(ctx context.Context, name string, c CacheInitializationFunc) error
- func SetString(ctx context.Context, c Cache, k string, v string) (string, error)
- type Cache
- func NewCache(ctx context.Context, uri string) (Cache, error)
- func NewFSCache(ctx context.Context, uri string) (Cache, error)
- func NewGoCache(ctx context.Context, uri string) (Cache, error)
- func NewMultiCache(ctx context.Context, str_uri string) (Cache, error)
- func NewMultiCacheWithCaches(ctx context.Context, caches ...Cache) (Cache, error)
- func NewNullCache(ctx context.Context, uri string) (Cache, error)
- type CacheInitializationFunc
- type CacheMiss
- type CacheMissMulti
- type FSCache
- func (c *FSCache) Close(ctx context.Context) error
- func (c *FSCache) Evictions() int64
- func (c *FSCache) Get(ctx context.Context, key string) (io.ReadSeekCloser, error)
- func (c *FSCache) Hits() int64
- func (c *FSCache) Misses() int64
- func (c *FSCache) Name() string
- func (c *FSCache) Set(ctx context.Context, key string, fh io.ReadSeekCloser) (io.ReadSeekCloser, error)
- func (c *FSCache) Size() int64
- func (c *FSCache) SizeWithContext(ctx context.Context) int64
- func (c *FSCache) Unset(ctx context.Context, key string) error
- type GoCache
- func (c *GoCache) Close(ctx context.Context) error
- func (c *GoCache) Evictions() int64
- func (c *GoCache) Get(ctx context.Context, key string) (io.ReadSeekCloser, error)
- func (c *GoCache) Hits() int64
- func (c *GoCache) Misses() int64
- func (c *GoCache) Name() string
- func (c *GoCache) Set(ctx context.Context, key string, fh io.ReadSeekCloser) (io.ReadSeekCloser, error)
- func (c *GoCache) Size() int64
- func (c *GoCache) SizeWithContext(ctx context.Context) int64
- func (c *GoCache) Unset(ctx context.Context, key string) error
- type GoCacheOptions
- type MultiCache
- func (mc *MultiCache) Close(ctx context.Context) error
- func (mc *MultiCache) Evictions() int64
- func (mc *MultiCache) Get(ctx context.Context, key string) (io.ReadSeekCloser, error)
- func (mc *MultiCache) Hits() int64
- func (mc *MultiCache) Misses() int64
- func (mc *MultiCache) Name() string
- func (mc *MultiCache) Set(ctx context.Context, key string, fh io.ReadSeekCloser) (io.ReadSeekCloser, error)
- func (mc *MultiCache) Size() int64
- func (mc *MultiCache) SizeWithContext(ctx context.Context) int64
- func (mc *MultiCache) Unset(ctx context.Context, key string) error
- type NullCache
- func (c *NullCache) Close(ctx context.Context) error
- func (c *NullCache) Evictions() int64
- func (c *NullCache) Get(ctx context.Context, key string) (io.ReadSeekCloser, error)
- func (c *NullCache) Hits() int64
- func (c *NullCache) Misses() int64
- func (c *NullCache) Name() string
- func (c *NullCache) Set(ctx context.Context, key string, fh io.ReadSeekCloser) (io.ReadSeekCloser, error)
- func (c *NullCache) Size() int64
- func (c *NullCache) SizeWithContext(ctx context.Context) int64
- func (c *NullCache) Unset(ctx context.Context, key string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsCacheMiss ¶
func IsCacheMissMulti ¶
func ReadSeekCloserFromString ¶ added in v0.5.0
func ReadSeekCloserFromString(v string) (io.ReadSeekCloser, error)
func RegisterCache ¶ added in v0.0.2
func RegisterCache(ctx context.Context, name string, c CacheInitializationFunc) error
Types ¶
type Cache ¶
type Cache interface { Close(context.Context) error Name() string Get(context.Context, string) (io.ReadSeekCloser, error) Set(context.Context, string, io.ReadSeekCloser) (io.ReadSeekCloser, error) Unset(context.Context, string) error Hits() int64 Misses() int64 Evictions() int64 Size() int64 SizeWithContext(context.Context) int64 }
func NewMultiCacheWithCaches ¶ added in v0.4.0
type CacheInitializationFunc ¶ added in v0.1.0
type CacheMissMulti ¶
type CacheMissMulti struct {
// contains filtered or unexported fields
}
func (CacheMissMulti) Error ¶
func (m CacheMissMulti) Error() string
type FSCache ¶
type FSCache struct { Cache TTL int64 FilePerms os.FileMode DirectoryPerms os.FileMode // contains filtered or unexported fields }
type GoCache ¶
type GoCache struct { Cache // contains filtered or unexported fields }
type GoCacheOptions ¶
func DefaultGoCacheOptions ¶
func DefaultGoCacheOptions() (*GoCacheOptions, error)
type MultiCache ¶
type MultiCache struct { Cache // contains filtered or unexported fields }
func (*MultiCache) Evictions ¶
func (mc *MultiCache) Evictions() int64
func (*MultiCache) Get ¶
func (mc *MultiCache) Get(ctx context.Context, key string) (io.ReadSeekCloser, error)
func (*MultiCache) Hits ¶
func (mc *MultiCache) Hits() int64
func (*MultiCache) Misses ¶
func (mc *MultiCache) Misses() int64
func (*MultiCache) Name ¶
func (mc *MultiCache) Name() string
func (*MultiCache) Set ¶
func (mc *MultiCache) Set(ctx context.Context, key string, fh io.ReadSeekCloser) (io.ReadSeekCloser, error)
func (*MultiCache) Size ¶
func (mc *MultiCache) Size() int64
func (*MultiCache) SizeWithContext ¶
func (mc *MultiCache) SizeWithContext(ctx context.Context) int64
Source Files
¶
Click to show internal directories.
Click to hide internal directories.