xorm-redis-cache: gitea.com/xorm/xorm-redis-cache Index | Files

package xormrediscache

import "gitea.com/xorm/xorm-redis-cache"

Index

Package Files

redis_cacher.go

Constants

const (
    DEFAULT_EXPIRATION = time.Duration(0)
    FOREVER_EXPIRATION = time.Duration(-1)

    LOGGING_PREFIX = "[redis_cacher]"
)

type RedisCacher Uses

type RedisCacher struct {
    Logger core.ILogger
    // contains filtered or unexported fields
}

RedisCacher wraps the Redis client to meet the Cache interface.

func MakeRedisCacher Uses

func MakeRedisCacher(pool *redis.Pool, defaultExpiration time.Duration, logger core.ILogger) *RedisCacher

MakeRedisCacher build a cacher based on redis.Pool

func NewRedisCacher Uses

func NewRedisCacher(host string, password string, defaultExpiration time.Duration, logger core.ILogger) *RedisCacher

NewRedisCacher creates a Redis Cacher, host as IP endpoint, i.e., localhost:6379, provide empty string or nil if Redis server doesn't require AUTH command, defaultExpiration sets the expire duration for a key to live. Until redigo supports sharding/clustering, only one host will be in hostList

engine.SetDefaultCacher(xormrediscache.NewRedisCacher("localhost:6379", "", xormrediscache.DEFAULT_EXPIRATION, engine.Logger))

or set MapCacher

engine.MapCacher(&user, xormrediscache.NewRedisCacher("localhost:6379", "", xormrediscache.DEFAULT_EXPIRATION, engine.Logger))

func (*RedisCacher) ClearBeans Uses

func (c *RedisCacher) ClearBeans(tableName string)

func (*RedisCacher) ClearIds Uses

func (c *RedisCacher) ClearIds(tableName string)

func (*RedisCacher) DelBean Uses

func (c *RedisCacher) DelBean(tableName string, id string)

func (*RedisCacher) DelIds Uses

func (c *RedisCacher) DelIds(tableName, sql string)

func (*RedisCacher) Flush Uses

func (c *RedisCacher) Flush() error

Flush deletes all xorm cached objects

func (*RedisCacher) GetBean Uses

func (c *RedisCacher) GetBean(tableName string, id string) interface{}

func (*RedisCacher) GetIds Uses

func (c *RedisCacher) GetIds(tableName, sql string) interface{}

func (*RedisCacher) GetPool Uses

func (c *RedisCacher) GetPool() (*redis.Pool, error)

func (*RedisCacher) PutBean Uses

func (c *RedisCacher) PutBean(tableName string, id string, obj interface{})

func (*RedisCacher) PutIds Uses

func (c *RedisCacher) PutIds(tableName, sql string, ids interface{})

func (*RedisCacher) SetPool Uses

func (c *RedisCacher) SetPool(pool *redis.Pool)

Package xormrediscache imports 9 packages (graph). Updated 2019-12-27. Refresh now. Tools for package owners.