cache

package
v0.0.0-...-fb81480 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package cache provides an abstraction for caching mechanisms used by the application. It allows setting and getting data from a cache backend (e.g., Redis).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	// Set stores data in the cache with a specified key.
	Set(ctx context.Context, key string, data any) error

	// Get retrieves data from the cache by the specified key.
	Get(ctx context.Context, key string, v any) error
}

Cache defines the interface for caching operations. It provides methods for storing and retrieving data.

func NewRedis

func NewRedis(ctx context.Context, cfg *configs.ServerConfig) (Cache, error)

NewRedis initializes a new Redis cache client and returns a Cache instance. It takes the context and server configuration to configure the Redis client.

Directories

Path Synopsis
Package redis provides a Redis-based caching implementation for the application.
Package redis provides a Redis-based caching implementation for the application.

Jump to

Keyboard shortcuts

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