cache

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const IsNil = redis.Nil
View Source
const PackageName = "cache"

Variables

This section is empty.

Functions

func AllCache added in v0.0.4

func AllCache(search string, page, rows int) (et.List, error)

* * AllCache * @params device string * @params key string * @params val string * @return error *

func Close added in v0.0.4

func Close()

func Count

func Count(key string, expiration time.Duration) int

* * Count * @params key string * @params expiration time.Duration (second) * @return int64 *

func Delete added in v0.0.4

func Delete(key string) (int64, error)

* * Delete * @params key string * @return int64, error *

func DeleteCtx added in v0.0.4

func DeleteCtx(ctx context.Context, key string) (int64, error)

* * DeleteCtx * @params ctx context.Context * @params key string * @return int64, error *

func DeleteVerify added in v0.0.4

func DeleteVerify(device string, key string) (int64, error)

* * DeleteVerify * @params device string * @params key string * @return int64, error *

func Empty added in v0.0.4

func Empty(match string) error

* * Empty * @return error *

func Exists added in v0.0.9

func Exists(key string) bool

* * Exists * @params key string * @return bool *

func ExistsCtx added in v0.0.9

func ExistsCtx(ctx context.Context, key string) bool

* * ExistsCtx * @params ctx context.Context * @params key string * @return bool *

func FromId added in v0.0.9

func FromId() string

* * FromId return the id of the connection * @return string *

func GenId added in v0.0.4

func GenId(args ...interface{}) string

* * GenId * @params args ...interface{} * @return string *

func GenKey added in v0.0.4

func GenKey(args ...interface{}) string

* * GenKey * @params args ...interface{} * @return string *

func Get

func Get(key, def string) (string, error)

* * Get * @params key string * @params def string * @return string, error *

func GetCtx added in v0.0.4

func GetCtx(ctx context.Context, key, def string) (string, error)

* * GetCtx * @params ctx context.Context * @params key string * @params def string * @return string, error *

func GetItem added in v0.0.4

func GetItem(key string) (et.Item, error)

* * GetItem * @params key string * @return Item, error *

func GetItems added in v0.0.4

func GetItems(key string) (et.Items, error)

* * GetItems * @params key string * @return Items, error *

func GetJson added in v0.0.4

func GetJson(key string) (et.Json, error)

* * GetJson * @params key string * @return Json, error *

func GetVerify added in v0.0.4

func GetVerify(device string, key string) (string, error)

* * GetVerify * @params device string * @params key string * @return string, error *

func HDelete added in v0.0.4

func HDelete(key, atr string) error

* * HDelete * @params key string * @params atr string * @return error *

func HDeleteCtx added in v0.0.4

func HDeleteCtx(ctx context.Context, key, atr string) error

* * HDeleteCtx * @params ctx context.Context * @params key string * @params atr string * @return error *

func HGet added in v0.0.4

func HGet(key string) (map[string]string, error)

* * HGet * @params key string * @return map[string]string, error *

func HGetAtrib added in v0.0.4

func HGetAtrib(key, atr string) (string, error)

* * HGetAtrib * @params key string * @params atr string * @return string, error *

func HGetCtx added in v0.0.4

func HGetCtx(ctx context.Context, key string) (map[string]string, error)

* * HGetCtx * @params ctx context.Context * @params key string * @return map[string]string, error *

func HSet added in v0.0.4

func HSet(key string, val map[string]string) error

* * HSet * @params key string * @params val map[string]string * @return error *

func HSetAtrib added in v0.0.4

func HSetAtrib(key, atr, val string) error

* * HSetAtrib * @params key string * @params atr string * @params val string * @return error *

func HSetCtx added in v0.0.4

func HSetCtx(ctx context.Context, key string, val map[string]string) error

* * HSetCtx * @params ctx context.Context * @params key string * @params val map[string]string * @return error *

func HandlerAll added in v0.0.4

func HandlerAll(w http.ResponseWriter, r *http.Request)

* * HandlerAll * @params w http.ResponseWriter * @params r *http.Request *

func HandlerDelete added in v0.0.4

func HandlerDelete(w http.ResponseWriter, r *http.Request)

* * HandlerDelete * @params w http.ResponseWriter * @params r *http.Request *

func HandlerGet added in v0.0.4

func HandlerGet(w http.ResponseWriter, r *http.Request)

* * HandlerGet * @params w http.ResponseWriter * @params r *http.Request *

func More added in v0.0.3

func More(key string, second time.Duration) int

* * More * @params key string * @params second time.Duration * @return int *

func Set

func Set(key string, val interface{}, second time.Duration) error

* * Set * @params key string * @params val interface{} * @params second time.Duration * @return error *

func SetCtx added in v0.0.4

func SetCtx(ctx context.Context, key, val string, second time.Duration) error

* * SetCtx * @params ctx context.Context * @params key string * @params val string * @params second time.Duration * @return error *

func SetD added in v0.0.3

func SetD(key string, val interface{}) error

* * SetD * @params key string * @params val interface{} * @return error *

func SetH added in v0.0.3

func SetH(key string, val interface{}) error

* * SetH * @params key string * @params val interface{} * @return error *

func SetM added in v0.0.3

func SetM(key string, val interface{}) error

* * SetM * @params key string * @params val interface{} * @return error *

func SetVerify added in v0.0.4

func SetVerify(device, key, val string, duration time.Duration) error

* * SetVerify * @params device string * @params key string * @params val string * @params duration time.Duration * @return error *

func SetW added in v0.0.3

func SetW(key string, val interface{}) error

* * SetW * @params key string * @params val interface{} * @return error *

func SetY added in v0.0.4

func SetY(key string, val interface{}) error

* * SetY * @params key string * @params val interface{} * @return error *

Types

type Conn added in v0.0.4

type Conn struct {
	*redis.Client
	// contains filtered or unexported fields
}

func ConnectTo added in v0.0.9

func ConnectTo(host, password string, dbname int) (*Conn, error)

func Load

func Load() (*Conn, error)

func (*Conn) Pub added in v0.0.9

func (s *Conn) Pub(channel string, message []byte) error

* * Pub * @param channel string * @param message interface{} * @return error *

func (*Conn) Sub added in v0.0.9

func (s *Conn) Sub(channel string, f func(*redis.Message))

* * Sub * @param channel string * @param f func(interface{}) *

func (*Conn) Unsub added in v0.0.9

func (s *Conn) Unsub(channel string) error

* * Unsub * @param channel string * @return error *

type Message added in v0.0.9

type Message struct {
	ID      string `json:"id"`
	Content string `json:"content"`
}

func (Message) ToJson added in v0.0.9

func (s Message) ToJson() (et.Json, error)

Jump to

Keyboard shortcuts

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