rediscache

package
v0.47.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RedisCache

type RedisCache struct {
	// contains filtered or unexported fields
}

func NewCache

func NewCache(redis redis.Redis) *RedisCache

func NewTTLCache

func NewTTLCache(redis redis.Redis, ttl time.Duration) *RedisCache

func (*RedisCache) Delete

func (c *RedisCache) Delete(k string) error

func (*RedisCache) Get

func (c *RedisCache) Get(k string) (interface{}, error)

func (*RedisCache) GetAll

func (c *RedisCache) GetAll() (map[string]interface{}, error)

func (*RedisCache) Put

func (c *RedisCache) Put(k string, v interface{}) error

It is caller's responsibility to encode Go struct.

type RedisHashCache

type RedisHashCache struct {
	// contains filtered or unexported fields
}

func NewHashCache

func NewHashCache(redis redis.Redis, key string) *RedisHashCache

func (*RedisHashCache) Delete

func (r *RedisHashCache) Delete(k string) error

func (*RedisHashCache) Get

func (r *RedisHashCache) Get(k string) (interface{}, error)

func (*RedisHashCache) GetAll

func (r *RedisHashCache) GetAll() (map[string]interface{}, error)

func (*RedisHashCache) Put

func (r *RedisHashCache) Put(k string, v interface{}) error

Put implementation for Putter interface. For TTLHashCache, Put acts mostly as normal Cache except it will check if the TTL for hashkey (not the key k), in case the TTL for hashkey is not yet existed or unset, EXPIRE will be called and set TTL time for the whole hashkey.

It is caller's responsibility to encode Go struct.

Jump to

Keyboard shortcuts

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