Help us shape the future of Go! Take the 2026 Go Developer Survey

redis

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts ...cache.Option) (cache.RawCache, error)

New creates a new Redis cache.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache is a Redis-backed cache implementation.

func (*Cache) Close

func (rc *Cache) Close() error

Close closes the Redis connection.

func (*Cache) Decrement

func (rc *Cache) Decrement(ctx context.Context, key string, delta int64) (int64, error)

Decrement atomically decrements a counter.

func (*Cache) Delete

func (rc *Cache) Delete(ctx context.Context, key string) error

Delete removes an item from the cache.

func (*Cache) Exists

func (rc *Cache) Exists(ctx context.Context, key string) (bool, error)

Exists checks if a key exists in the cache.

func (*Cache) Expire

func (rc *Cache) Expire(ctx context.Context, key string, ttl time.Duration) error

Expire updates the TTL of an existing key.

func (*Cache) Flush

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

Flush clears all items from the cache.

func (*Cache) Get

func (rc *Cache) Get(ctx context.Context, key string) ([]byte, bool, error)

Get retrieves an item from the cache.

func (*Cache) Increment

func (rc *Cache) Increment(ctx context.Context, key string, delta int64) (int64, error)

Increment atomically increments a counter.

func (*Cache) Set

func (rc *Cache) Set(ctx context.Context, key string, value []byte, ttl time.Duration) error

Set sets an item in the cache with the specified TTL.

func (*Cache) SupportsPerKeyTTL

func (rc *Cache) SupportsPerKeyTTL() bool

Jump to

Keyboard shortcuts

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