Versions in this module Expand all Collapse all v1 v1.0.2 Apr 10, 2026 Changes in this version type Option + func WithExpirationResolution[K comparable, V any](resolution time.Duration) Option[K, V] + func WithMetrics[K comparable, V any](enabled bool) Option[K, V] v1.0.1 Mar 22, 2026 Changes in this version + const TTL_FOREVER + type BatchResult struct + Found []bool + Hashes []uint64 + Keys []K + Values []V + type Cache struct + func NewCache[K comparable, V any](opts ...Option[K, V]) *Cache[K, V] + func (c *Cache[K, V]) Clear() + func (c *Cache[K, V]) Close() + func (c *Cache[K, V]) Delete(key K) bool + func (c *Cache[K, V]) DeleteMany(keys []K) int + func (c *Cache[K, V]) Get(key K) (V, bool) + func (c *Cache[K, V]) GetBatch(keys []K) *BatchResult[K, V] + func (c *Cache[K, V]) GetBatchOptimized(keys []K) *BatchResult[K, V] + func (c *Cache[K, V]) GetBatchToMap(keys []K) map[K]V + func (c *Cache[K, V]) GetMany(keys []K) map[K]V + func (c *Cache[K, V]) Has(key K) bool + func (c *Cache[K, V]) Len() int + func (c *Cache[K, V]) Metrics() MetricsSnapshot + func (c *Cache[K, V]) Scan(cursor uint64, count int) *Iterator[K, V] + func (c *Cache[K, V]) ScanMatch(pattern string, cursor uint64, count int) *Iterator[K, V] + func (c *Cache[K, V]) ScanPrefix(prefix string, cursor uint64, count int) *Iterator[K, V] + func (c *Cache[K, V]) Set(key K, value V, ttl time.Duration) bool + func (c *Cache[K, V]) SetMany(items []Item[K, V]) int + func (c *Cache[K, V]) SetWithCost(key K, value V, cost int64, ttl time.Duration) bool + func (c *Cache[K, V]) Wait() + type CacheDriver struct + func New() *CacheDriver + func StartInstance() *CacheDriver + func (mc *CacheDriver) Close() map[string]interface{} + func (mc *CacheDriver) GCBufferQueue() int + func (mc *CacheDriver) Get(key string) (interface{}, bool) + func (mc *CacheDriver) GetPointer(key string) (interface{}, bool) + func (mc *CacheDriver) Len() int + func (mc *CacheDriver) Remove(key string) + func (mc *CacheDriver) Set(key string, value interface{}, ttl time.Duration) error + func (mc *CacheDriver) SetPointer(key string, value interface{}, ttl time.Duration) error + func (mc *CacheDriver) Truncate() + type Item struct + Cost int64 + Key K + TTL time.Duration + Value V + type Iterator struct + func (it *Iterator[K, V]) All() []Item[K, V] + func (it *Iterator[K, V]) Close() + func (it *Iterator[K, V]) Count() int + func (it *Iterator[K, V]) Cursor() uint64 + func (it *Iterator[K, V]) Entry() (K, V) + func (it *Iterator[K, V]) Err() error + func (it *Iterator[K, V]) ForEach(fn func(key K, value V) bool) + func (it *Iterator[K, V]) Key() K + func (it *Iterator[K, V]) Keys() []K + func (it *Iterator[K, V]) Next() bool + func (it *Iterator[K, V]) Value() V + func (it *Iterator[K, V]) Values() []V + type Metrics struct + func (m *Metrics) Reset() + func (m *Metrics) Snapshot() MetricsSnapshot + type MetricsSnapshot struct + BufferDrops int64 + CostAdded int64 + CostEvicted int64 + Deletes int64 + Evictions int64 + Expirations int64 + HitRatio float64 + Hits int64 + Misses int64 + Rejections int64 + Sets int64 + type Option func(*config[K, V]) + func WithBufferItems[K comparable, V any](n int64) Option[K, V] + func WithCostFunc[K comparable, V any](fn func(V) int64) Option[K, V] + func WithDefaultTTL[K comparable, V any](ttl time.Duration) Option[K, V] + func WithIgnoreInternalCost[K comparable, V any](ignore bool) Option[K, V] + func WithKeyHasher[K comparable, V any](fn func(K) uint64) Option[K, V] + func WithLockFreePolicy[K comparable, V any](enabled bool) Option[K, V] + func WithMaxCost[K comparable, V any](cost int64) Option[K, V] + func WithMaxEntries[K comparable, V any](n int64) Option[K, V] + func WithNumCounters[K comparable, V any](n int64) Option[K, V] + func WithOnEvict[K comparable, V any](fn func(K, V, int64)) Option[K, V] + func WithOnExpire[K comparable, V any](fn func(K, V)) Option[K, V] + func WithOnReject[K comparable, V any](fn func(K, V)) Option[K, V] + func WithPrefixSearch[K comparable, V any](enabled bool) Option[K, V] + func WithShardCount[K comparable, V any](n int) Option[K, V]