Versions in this module Expand all Collapse all v1 v1.0.1 Oct 30, 2024 v1.0.0 Oct 29, 2024 Changes in this version + const MAX_BLOB_SIZE + const MAX_PARAMS + const NO_TTL + const NS_DEFAULT + const RANGE_MAX + const RANGE_MIN + var NotFound = errors.New("not found") + func Hit(err error) (bool, error) + func Miss(err error) (bool, error) + func URIFromPath(path string) string + func URITemp() string + func Unzip[V any](kv []KV[V]) (keys []string, vals []V) + func Vacuum(interval time.Duration, max int) func(cache *Cache) + type Cache struct + func New(uri string, op ...Op) (*Cache, error) + func (c *Cache) BatchEvict(keys []string) (evicted []KV[[]byte], err error) + func (c *Cache) BatchGet(keys []string) ([]KV[[]byte], error) + func (c *Cache) BatchSet(rows []KV[[]byte]) error + func (c *Cache) Close() error + func (c *Cache) Evict(key string) (kv KV[[]byte], err error) + func (c *Cache) EvictAll() (len int, err error) + func (c *Cache) Get(key string) ([]byte, error) + func (c *Cache) GetOr(key string, fetch func(k string) ([]byte, error)) ([]byte, error) + func (c *Cache) ItrKeys(from string, to string) iter.Seq[string] + func (c *Cache) ItrRange(from string, to string) iter.Seq2[string, []byte] + func (c *Cache) ItrValues(from string, to string) iter.Seq[[]byte] + func (c *Cache) Keys(from string, to string) (keys []string, err error) + func (c *Cache) NS(ns string, ops ...Op) (*Cache, error) + func (c *Cache) Range(from string, to string) (kv []KV[[]byte], err error) + func (c *Cache) Set(key string, value []byte) error + func (c *Cache) SetTTL(key string, value []byte, ttl time.Duration) error + func (c *Cache) Vacuum(max int) (n int, err error) + func (c *Cache) Values(from string, to string) (values [][]byte, err error) + type KV struct + K string + V T + func Zip[V any](keys []string, values []V) []KV[V] + func (kv KV[T]) Key() string + func (kv KV[T]) Unzip() (string, T) + func (kv KV[T]) Value() T + type Op func(*Cache) error + func DBPragma(s string) Op + func DBRemoveOnClose() Op + func DBSyncOff() Op + func WithEvictCallback(cb func(key string, val []byte)) Op + func WithLogger(log *slog.Logger) Op + func WithTTL(defaultTTL time.Duration) Op + func WithVacuum(vacuum func(cache *Cache)) Op + type TypedCache struct + func Of[V any](cache *Cache) *TypedCache[V] + func (t *TypedCache[V]) BatchEvict(keys []string) ([]KV[V], error) + func (t *TypedCache[V]) BatchGet(keys []string) ([]KV[V], error) + func (t *TypedCache[V]) BatchSet(ziped []KV[V]) error + func (t *TypedCache[V]) Evict(key string) (KV[V], error) + func (t *TypedCache[V]) EvictAll() (int, error) + func (t *TypedCache[V]) Get(key string) (V, error) + func (t *TypedCache[V]) GetOr(key string, getter func(key string) (V, error)) (V, error) + func (t *TypedCache[V]) ItrKeys(from string, to string) iter.Seq[string] + func (t *TypedCache[V]) ItrRange(from string, to string) iter.Seq2[string, V] + func (t *TypedCache[V]) ItrValues(from string, to string) iter.Seq[V] + func (t *TypedCache[V]) Keys(from string, to string) (keys []string, err error) + func (t *TypedCache[V]) Range(from string, to string) ([]KV[V], error) + func (t *TypedCache[V]) Raw() *Cache + func (t *TypedCache[V]) Set(key string, value V) error + func (t *TypedCache[V]) SetTTL(key string, value V, ttl time.Duration) error + func (t *TypedCache[V]) Values(from string, to string) (values []V, err error)