Skip to content
This repository was archived by the owner on Feb 20, 2021. It is now read-only.

Latest commit

 

History

History
24 lines (19 loc) · 561 Bytes

File metadata and controls

24 lines (19 loc) · 561 Bytes

TTLCache - an in-memory LRU cache with expiration

TTLCache is a minimal wrapper over a string map 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/wunderlist/ttlcache"
)

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