redis

package
v1.69.13 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2025 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) 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.

Jump to

Keyboard shortcuts

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