cache

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2025 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDuration

func CreateDuration(seconds int) time.Duration

CreateDuration creates a time.Duration from seconds.

func GenerateCacheKey added in v0.1.3

func GenerateCacheKey(req *http.Request) string

GenerateCacheKey generates a cache key based on the request's remote address and URL path.

func GetCache

func GetCache[T any](key string, payload *T) error

GetCache retrieves a value from the cache using the provided key and unmarshals it into the provided payload.

func InitCache

func InitCache() *redis.Client

func SetCache

func SetCache[T any](key string, payload T, TTL time.Duration) error

SetCache stores a value in the cache with the provided key and TTL (time-to-live).

Types

This section is empty.

Jump to

Keyboard shortcuts

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