Skip to content

Fast, Simple, & Threadsafe Ruby In-Memory Store with expiration

License

Notifications You must be signed in to change notification settings

grosser/expiring_memory_store

Repository files navigation

Fast, Simple, & Threadsafe Ruby In-Memory Store with expiration

  • Fast (using Process::CLOCK_MONOTONIC)
  • Simple
  • Threadsafe
  • Can cache nil

Install

gem install expiring_memory_store

Usage

store = ExpiringMemoryStore.new
store.set :a, 1, expires_in: 4
store.get :a # -> 1
store.get :b # -> nil
store.add :a, 2, expires_in: 4 # -> false
store.fetch(:a) { 1 } # -> 1
store.cleanup # remove all expired entries

Author

Michael Grosser
michael@grosser.it
License: MIT
Build Status

About

Fast, Simple, & Threadsafe Ruby In-Memory Store with expiration

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages