cache

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsClient

func AsClient(client interface{}) *ledis.Ledis

func New

func New() cache.Cache

Types

type LedisCacher

type LedisCacher struct {
	cache.GetAs
	// contains filtered or unexported fields
}

LedisCacher represents a ledis cache adapter implementation.

func (*LedisCacher) Client

func (c *LedisCacher) Client() interface{}

func (*LedisCacher) Close

func (c *LedisCacher) Close() error

func (*LedisCacher) Codec

func (c *LedisCacher) Codec() encoding.Codec

func (*LedisCacher) Decr

func (c *LedisCacher) Decr(ctx context.Context, key string) error

Decr decreases cached int-type value by given key as a counter.

func (*LedisCacher) Delete

func (c *LedisCacher) Delete(ctx context.Context, key string) (err error)

Delete deletes cached value by given key.

func (*LedisCacher) Flush

func (c *LedisCacher) Flush(ctx context.Context) error

Flush deletes all cached data.

func (*LedisCacher) Get

func (c *LedisCacher) Get(ctx context.Context, key string, value interface{}) error

Get gets cached value by given key.

func (*LedisCacher) Incr

func (c *LedisCacher) Incr(ctx context.Context, key string) error

Incr increases cached int-type value by given key as a counter.

func (*LedisCacher) IsExist

func (c *LedisCacher) IsExist(ctx context.Context, key string) (bool, error)

IsExist returns true if cached value exists.

func (*LedisCacher) Put

func (c *LedisCacher) Put(ctx context.Context, key string, val interface{}, expire int64) (err error)

Put puts value into cache with key and expire time. If expired is 0, it lives forever.

func (*LedisCacher) SetCodec

func (c *LedisCacher) SetCodec(codec encoding.Codec)

func (*LedisCacher) StartAndGC

func (c *LedisCacher) StartAndGC(ctx context.Context, opts cache.Options) error

StartAndGC starts GC routine based on config string settings. AdapterConfig: data_dir=./app.db,db=0

Jump to

Keyboard shortcuts

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