Documentation
¶
Index ¶
- type BadgerCache
- func (b *BadgerCache) Close() error
- func (b *BadgerCache) Empty() error
- func (b *BadgerCache) EmptyByMatch(str string) error
- func (b *BadgerCache) Forget(str string) error
- func (b *BadgerCache) Get(str string, dest any) (any, error)
- func (c *BadgerCache) GetAll() (map[string]any, error)
- func (b *BadgerCache) GetDefaultOpts() *Options
- func (b *BadgerCache) GetInt(key string) (int, error)
- func (b *BadgerCache) GetString(key string) (string, error)
- func (b *BadgerCache) GetTime(key string) (time.Time, error)
- func (b *BadgerCache) Has(str string) bool
- func (c *BadgerCache) JSONDel(key string) error
- func (c *BadgerCache) JSONGet(key string) (any, error)
- func (c *BadgerCache) JSONSearch(index string, query string) ([]any, error)
- func (c *BadgerCache) JSONSet(key string, data any) error
- func (b *BadgerCache) Set(str string, value any, expires ...time.Duration) error
- type BuntDBCache
- func (b *BuntDBCache) Close() error
- func (b *BuntDBCache) Empty() error
- func (b *BuntDBCache) EmptyByMatch(str string) error
- func (b *BuntDBCache) Forget(str string) error
- func (b *BuntDBCache) Get(str string, dest any) (any, error)
- func (c *BuntDBCache) GetAll() (map[string]any, error)
- func (c *BuntDBCache) GetDefaultOpts() *Options
- func (b *BuntDBCache) GetInt(key string) (int, error)
- func (b *BuntDBCache) GetString(key string) (string, error)
- func (b *BuntDBCache) GetTime(key string) (time.Time, error)
- func (b *BuntDBCache) Has(str string) bool
- func (c *BuntDBCache) JSONDel(key string) error
- func (c *BuntDBCache) JSONGet(key string) (any, error)
- func (c *BuntDBCache) JSONSearch(index string, query string) ([]any, error)
- func (c *BuntDBCache) JSONSet(key string, data any) error
- func (b *BuntDBCache) Set(str string, value any, expires ...time.Duration) error
- type Cacher
- type Options
- type RedisCache
- func (c *RedisCache) Close() error
- func (c *RedisCache) Empty() error
- func (c *RedisCache) EmptyByMatch(match string) error
- func (c *RedisCache) Forget(key string) error
- func (c *RedisCache) Get(key string, dest any) (any, error)
- func (c *RedisCache) GetAll() (map[string]any, error)
- func (c *RedisCache) GetDefaultOpts() *Options
- func (c *RedisCache) GetInt(key string) (int, error)
- func (c *RedisCache) GetString(key string) (string, error)
- func (c *RedisCache) GetTime(key string) (time.Time, error)
- func (c *RedisCache) Has(key string) bool
- func (c *RedisCache) JSONDel(key string) error
- func (c *RedisCache) JSONGet(key string) (any, error)
- func (c *RedisCache) JSONSearch(index string, query string) ([]any, error)
- func (c *RedisCache) JSONSet(key string, data any) error
- func (c *RedisCache) Set(key string, data any, expires ...time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BadgerCache ¶
func (*BadgerCache) Empty ¶
func (b *BadgerCache) Empty() error
Empty removes all entries in Badger.
func (*BadgerCache) EmptyByMatch ¶
func (b *BadgerCache) EmptyByMatch(str string) error
EmptyByMatch removes all entries in Redis which have the prefix match.
func (*BadgerCache) Forget ¶
func (b *BadgerCache) Forget(str string) error
Forget removes an item from the cache, by key.
func (*BadgerCache) Get ¶
func (b *BadgerCache) Get(str string, dest any) (any, error)
Get attempts to retrieve a value from the cache.
func (*BadgerCache) GetDefaultOpts ¶
func (b *BadgerCache) GetDefaultOpts() *Options
func (*BadgerCache) GetInt ¶
func (b *BadgerCache) GetInt(key string) (int, error)
GetInt is a convenience method which retrieves a value from the cache, converts it to an int, and returns it.
func (*BadgerCache) GetString ¶
func (b *BadgerCache) GetString(key string) (string, error)
GetString is a convenience method which retrieves a value from the cache and returns it as a string.
func (*BadgerCache) GetTime ¶
func (b *BadgerCache) GetTime(key string) (time.Time, error)
GetTime retrieves a value from the cache by the specified key and returns it as time.Time.
func (*BadgerCache) Has ¶
func (b *BadgerCache) Has(str string) bool
func (*BadgerCache) JSONDel ¶
func (c *BadgerCache) JSONDel(key string) error
func (*BadgerCache) JSONSearch ¶
func (c *BadgerCache) JSONSearch(index string, query string) ([]any, error)
type BuntDBCache ¶
func (*BuntDBCache) Empty ¶
func (b *BuntDBCache) Empty() error
Empty removes all entries in Badger.
func (*BuntDBCache) EmptyByMatch ¶
func (b *BuntDBCache) EmptyByMatch(str string) error
EmptyByMatch removes all entries in Redis which have the prefix match.
func (*BuntDBCache) Forget ¶
func (b *BuntDBCache) Forget(str string) error
Forget removes an item from the cache, by key.
func (*BuntDBCache) Get ¶
func (b *BuntDBCache) Get(str string, dest any) (any, error)
Get attempts to retrieve a value from the cache.
func (*BuntDBCache) GetDefaultOpts ¶
func (c *BuntDBCache) GetDefaultOpts() *Options
func (*BuntDBCache) GetInt ¶
func (b *BuntDBCache) GetInt(key string) (int, error)
GetInt is a convenience method which retrieves a value from the cache, converts it to an int, and returns it.
func (*BuntDBCache) GetString ¶
func (b *BuntDBCache) GetString(key string) (string, error)
GetString is a convenience method which retrieves a value from the cache and returns it as a string.
func (*BuntDBCache) GetTime ¶
func (b *BuntDBCache) GetTime(key string) (time.Time, error)
GetTime retrieves a value from the cache by the specified key and returns it as time.Time.
func (*BuntDBCache) Has ¶
func (b *BuntDBCache) Has(str string) bool
func (*BuntDBCache) JSONDel ¶
func (c *BuntDBCache) JSONDel(key string) error
func (*BuntDBCache) JSONSearch ¶
func (c *BuntDBCache) JSONSearch(index string, query string) ([]any, error)
type Cacher ¶
type Cacher interface {
GetDefaultOpts() *Options
Empty() error
EmptyByMatch(match string) error
Forget(key string) error
Get(key string, dest any) (any, error)
GetInt(key string) (int, error)
GetString(key string) (string, error)
GetTime(key string) (time.Time, error)
GetAll() (map[string]any, error)
Has(key string) bool
Set(key string, data any, expires ...time.Duration) error
JSONSet(key string, data any) error
JSONGet(key string) (any, error)
JSONDel(key string) error
JSONSearch(index string, query string) ([]any, error)
Close() error
// contains filtered or unexported methods
}
Cacher is the interface which anything providing cache functionality must satisfy.
type Options ¶
type Options struct {
Server string `yaml:"server"` // The server where Redis exists.
Port string `yaml:"port"` // The port Redis is listening on.
Password string `yaml:"password"` // The password for Redis.
Prefix string `yaml:"prefix"` // A prefix to use for all keys for this client.
DB int `yaml:"db"` // Database. Specifying 0 (the default) means use the default database.
Path string `yaml:"path"` // The location for the database on disk.
}
Options is the type used to configure a Cacher object.
type RedisCache ¶
func (*RedisCache) Close ¶
func (c *RedisCache) Close() error
Close closes the pool of redis connections
func (*RedisCache) Empty ¶
func (c *RedisCache) Empty() error
Empty removes all entries in Redis for a given client.
func (*RedisCache) EmptyByMatch ¶
func (c *RedisCache) EmptyByMatch(match string) error
EmptyByMatch removes all entries in Redis which have the prefix match.
func (*RedisCache) Forget ¶
func (c *RedisCache) Forget(key string) error
Forget removes an item from the cache, by key.
func (*RedisCache) Get ¶
func (c *RedisCache) Get(key string, dest any) (any, error)
Get attempts to retrieve a value from the cache.
func (*RedisCache) GetDefaultOpts ¶
func (c *RedisCache) GetDefaultOpts() *Options
func (*RedisCache) GetInt ¶
func (c *RedisCache) GetInt(key string) (int, error)
GetInt is a convenience method which retrieves a value from the cache, converts it to an int, and returns it.
func (*RedisCache) GetString ¶
func (c *RedisCache) GetString(key string) (string, error)
GetString is a convenience method which retrieves a value from the cache and returns it as a string.
func (*RedisCache) GetTime ¶
func (c *RedisCache) GetTime(key string) (time.Time, error)
GetTime retrieves a value from the cache by the specified key and returns it as time.Time.
func (*RedisCache) Has ¶
func (c *RedisCache) Has(key string) bool
Has checks to see if the supplied key is in the cache and returns true if found, otherwise false.
func (*RedisCache) JSONDel ¶
func (c *RedisCache) JSONDel(key string) error
func (*RedisCache) JSONSearch ¶
func (c *RedisCache) JSONSearch(index string, query string) ([]any, error)