libpack_cache_memory

package
v0.28.35 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const CompressionThreshold = 1024 // 1KB

CompressionThreshold is the minimum size in bytes before a value is compressed

View Source
const MaxCacheSize = 10000

MaxCacheSize is the maximum number of entries in the cache

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func New

func New(globalTTL time.Duration) *Cache

func (*Cache) CleanExpiredEntries

func (c *Cache) CleanExpiredEntries()

func (*Cache) Clear

func (c *Cache) Clear()

func (*Cache) CountQueries

func (c *Cache) CountQueries() int64

func (*Cache) Delete

func (c *Cache) Delete(key string)

func (*Cache) Get

func (c *Cache) Get(key string) ([]byte, bool)

func (*Cache) Set

func (c *Cache) Set(key string, value []byte, ttl time.Duration)

type CacheEntry

type CacheEntry struct {
	ExpiresAt  time.Time
	Value      []byte
	Compressed bool
}

Jump to

Keyboard shortcuts

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