redis

package module
v0.0.0-...-8a747b5 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

README

Redis Cache (preview)

This plugin designed to support Redis cache.

How to use

Build
./answer build --with github.com/answerdev/answer-redis-cache
Configuration
  • Endpoint - Redis connection address

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	Config      *CacheConfig
	RedisClient *redis.Client
}

func (*Cache) ConfigFields

func (c *Cache) ConfigFields() []plugin.ConfigField

func (*Cache) ConfigReceiver

func (c *Cache) ConfigReceiver(config []byte) error

func (*Cache) Decrease

func (c *Cache) Decrease(ctx context.Context, key string, value int64) (data int64, err error)

func (*Cache) Del

func (c *Cache) Del(ctx context.Context, key string) error

func (*Cache) Flush

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

func (*Cache) GetInt64

func (c *Cache) GetInt64(ctx context.Context, key string) (data int64, exist bool, err error)

func (*Cache) GetString

func (c *Cache) GetString(ctx context.Context, key string) (data string, exist bool, err error)

func (*Cache) Increase

func (c *Cache) Increase(ctx context.Context, key string, value int64) (data int64, err error)

func (*Cache) Info

func (c *Cache) Info() plugin.Info

func (*Cache) SetInt64

func (c *Cache) SetInt64(ctx context.Context, key string, value int64, ttl time.Duration) error

func (*Cache) SetString

func (c *Cache) SetString(ctx context.Context, key, value string, ttl time.Duration) error

type CacheConfig

type CacheConfig struct {
	Endpoint string `json:"endpoint"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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