redis

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: May 2, 2022 License: GPL-3.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 Cache

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

func New

func New(config *Config) *Cache

New represents a new redis client

func (*Cache) Clear

func (c *Cache) Clear()

Clear removes all keys and closes the client

func (*Cache) Del

func (c *Cache) Del(key string) (err error)

Del removes a value from redis

func (*Cache) Get

func (c *Cache) Get(key string, value interface{}) (err error)

Get retrieves value at key from cache

func (*Cache) HDel

func (c *Cache) HDel(key, prop string) error

func (*Cache) HGet

func (c *Cache) HGet(key, prop string, ptr interface{}) error

func (*Cache) HGetAll

func (c *Cache) HGetAll(key string) (map[string]string, error)

func (*Cache) HInc

func (c *Cache) HInc(key, prop string) int

func (*Cache) HSet

func (c *Cache) HSet(key, prop string, val interface{}) error

func (*Cache) Has

func (c *Cache) Has(key string) (ok bool)

Has checks if key is available in cache

func (*Cache) Inc

func (c *Cache) Inc(key string) int

func (*Cache) Keys

func (c *Cache) Keys(pattern string) (available []string)

Keys list all available cache keys

func (*Cache) Publish

func (c *Cache) Publish(channel string, message interface{}) *redis.IntCmd

func (*Cache) Set

func (c *Cache) Set(key string, value interface{}, ttl time.Duration) (err error)

Set stores a key with a given life time. 0 for permanent

func (*Cache) Subscribe

func (c *Cache) Subscribe(key string, redisMessageHandler func(msg *redis.Message), channels ...string) *redis.PubSub

func (*Cache) Type

func (c *Cache) Type() string

Type returns the type of the cache

func (*Cache) Unsubscribe

func (c *Cache) Unsubscribe(key string)

type Config

type Config struct {
	Addr     string `config:"platform.cache.redis.addr" default:"localhost:6379"`
	Password string `config:"platform.cache.redis.password" default:""`
}

type SubscriptionInfo

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

Jump to

Keyboard shortcuts

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