Skip to content


Subversion checkout URL

You can clone with
Download ZIP
a unified interface to key/value stores

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.

Juno: A unified interface for key/value stores

Build Status Dependency Status Code Climate

Juno provides a standard interface for interacting with various kinds of key/value stores. Juno is based on Moneta and replaces it with a mostly compatible interface. The reason for the fork was that Moneta was unmaintained for a long time.

Out of the box, it supports:

  • File Store
  • Memcached store (memcached and dalli)
  • In-memory store
  • DataMapper
  • BerkeleyDB (dbm)
  • GDBM
  • SDBM
  • Redis
  • Riak
  • TokyoCabinet
  • CouchDB
  • MongoDB
  • ActiveRecord
  • YAML store
  • PStore
  • LocalMemCache
  • Sequel
  • Sqlite3

The Juno API is purposely extremely similar to the Hash API. In order so support an identical API across stores, it does not support iteration or partial matches.


#initialize(options)              options differs per-store, and is used to set up the store

#[](key)                          retrieve a key. if the key is not available, return nil

#fetch(key, options = {}, &block) retrieve a key. if the key is not available, execute the
                                  block and return its return value.

#fetch(key, value, options = {})  retrieve a key. if the key is not available, return the value

#[]=(key, value)                  set a value for a key. if the key is already used, clobber it.
                                  keys set using []= will never expire

#delete(key, options = {})        delete the key from the store and return the current value

#key?(key, options = {})          true if the key exists, false if it does not

#store(key, value, options = {})  same as []=, but you can supply options

#clear(options = {})              clear all keys in this store

#close                            close database connection

Proxy store & Expiry

The memcached backend supports expires values directly:

cache =
# Expires in 10 seconds, value, :expires => 10)

You can add the expires feature to other backends using the Expires proxy:

cache =, value, :expires => 10)


  • Moneta originally by wycats
  • Juno by Daniel Mendler
Something went wrong with that request. Please try again.