Skip to content

Latest commit

 

History

History
32 lines (24 loc) · 1.09 KB

README.md

File metadata and controls

32 lines (24 loc) · 1.09 KB

wcache

License Godoc Reference

Implements in-memory cache with write-back strategy (a cache with expiration). An expiration callback(expireFn) will be called when record is expired.

Features

  • Thread-safe.
  • Per-key or global TTL.
  • Can trigger a custom callback on key expiration(could be used as Pub/Sub with aggregation).
  • Can trigger a custom callback on key collisions(e.g. for aggregating metrics). By default, will overwrite value.
  • Graceful shutdown(using context). Will call expiration callback for all records, ignoring they TTL.

Install

go get github.com/vtopc/wcache

TODO

  • Optional auto-extending expiration on Get and/or Set.

Similar projects