cache

package
v1.4.8 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheService

type CacheService interface {
	Get(ctx context.Context, key string) (string, error)
	Set(ctx context.Context, key, value string, expiration time.Duration) error
	Remove(ctx context.Context, key string) error
	CountKeys(ctx context.Context) (int64, error)
	ClearPattern(ctx context.Context, pattern string) (int64, error)
	Close() error
}

type RedisCacheService

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

RedisCacheService implements CacheService using Redis

func NewRedisCacheService

func NewRedisCacheService(ctx context.Context) (*RedisCacheService, error)

NewRedisCacheService creates a new instance of RedisCacheService

func (*RedisCacheService) ClearPattern

func (svc *RedisCacheService) ClearPattern(ctx context.Context, pattern string) (int64, error)

func (*RedisCacheService) Close

func (svc *RedisCacheService) Close() error

Close closes the Redis client

func (*RedisCacheService) CountKeys

func (svc *RedisCacheService) CountKeys(ctx context.Context) (int64, error)

CountKeys counts the number of keys in the Redis cache

func (*RedisCacheService) Get

func (svc *RedisCacheService) Get(ctx context.Context, key string) (string, error)

Get retrieves value from cache by key

func (*RedisCacheService) Remove

func (svc *RedisCacheService) Remove(ctx context.Context, key string) error

Remove implements CacheService.

func (*RedisCacheService) Set

func (svc *RedisCacheService) Set(ctx context.Context, key, value string, expiration time.Duration) error

Set sets value in cache with specified key

Jump to

Keyboard shortcuts

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