cache

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RedisService

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

RedisService represents a simple in-memory Redis-like service.

func NewMockService

func NewMockService() *RedisService

NewRedisService creates a new instance of RedisService.

func (*RedisService) Delete

func (r *RedisService) Delete(ctx context.Context, key string) error

Delete removes a key-value pair from the Redis service.

func (*RedisService) Expire

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

Expire sets a TTL (time-to-live) for a key.

func (*RedisService) Get

func (r *RedisService) Get(ctx context.Context, key string) (string, error)

Get retrieves the value for a given key from the Redis service. It returns an error if the key does not exist or has expired.

func (*RedisService) Set

func (r *RedisService) Set(ctx context.Context, key string, value string, ttl time.Duration) error

Set stores a key-value pair in the Redis service with an optional TTL.

type Service

type Service interface {
	Set(ctx context.Context, key string, value string, ttl time.Duration) error
	Get(ctx context.Context, key string) (string, error)
	Delete(ctx context.Context, key string) error
	Expire(ctx context.Context, key string, ttl time.Duration) error
}

func NewRedisService

func NewRedisService(host string, password sdk.MaskedBytes) Service

Jump to

Keyboard shortcuts

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