cache

package
v1.0.23 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteFromCache

func DeleteFromCache(ctx context.Context, store *CacheStore, key string)

func GetFromCache

func GetFromCache[T any](ctx context.Context, store *CacheStore, key string) (*T, bool)

func SetToCache

func SetToCache[T any](ctx context.Context, store *CacheStore, key string, data *T, expiration time.Duration)

Types

type CacheStats added in v1.0.16

type CacheStats struct {
	TotalKeys       int64     `json:"total_keys"`
	HitRate         float64   `json:"hit_rate"`
	MemoryUsed      int64     `json:"memory_used"`
	MemoryUsedHuman string    `json:"memory_used_human"`
	ExpiredKeys     int64     `json:"expired_keys"`
	LastCleanupTime time.Time `json:"last_cleanup_time"`
}

type CacheStore

type CacheStore struct {
	Logger logger.LoggerInterface
	// contains filtered or unexported fields
}

func (*CacheStore) ClearExpired added in v1.0.16

func (store *CacheStore) ClearExpired(ctx context.Context) (int64, error)

func (*CacheStore) GetRefCount added in v1.0.16

func (store *CacheStore) GetRefCount() int64

func (*CacheStore) GetStats added in v1.0.16

func (store *CacheStore) GetStats(ctx context.Context) (*CacheStats, error)

func (*CacheStore) InvalidateCache added in v1.0.16

func (store *CacheStore) InvalidateCache(ctx context.Context, pattern string) (int64, error)

Jump to

Keyboard shortcuts

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