mikkeloscar / ttlcache

an in-memory LRU string-string map with expiration for golang (but without auto-extending)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TTLCache - an in-memory LRU cache with expiration

TTLCache is a minimal wrapper over a map of strings to a slice of strings in golang, entries of which are

  1. Thread-safe
  2. Auto-Expiring after a certain time
  3. Auto-Extending expiration on Gets

Build Status

Usage

import (
  "time"
  "github.com/linki/ttlcache"
)

func main () {
  cache := ttlcache.NewCache(time.Second)
  cache.Set("key", "value")
  value, exists := cache.Get("key")
  count := cache.Count()
}

About

an in-memory LRU string-string map with expiration for golang (but without auto-extending)


Languages

Language:Go 100.0%