redis

package module
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2025 License: Apache-2.0 Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Redis Cache (preview)

This plugin designed to support Redis cache.

How to use

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	//go:embed  info.yaml
	Info embed.FS
)

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"`
	Username string `json:"username"`
	Password string `json:"password"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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