Table of Contents - moneta-0.7.20 Documentation
Pages
-
LICENSE
-
README
- Moneta: A unified interface for key/value stores
- Getting started
- Create a simple file store
- Store some entries
- Read entry
- Links
- Supported backends
- Backend feature matrix
- Proxies
- Serializers and compressors (Moneta::Transformer)
- Moneta API
- initialize(options) options differs per-store, and is used to set up the store.
- retrieve a key. If the key is not available, return nil.
- load(key, options = {}) 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
- 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.
- store(key, value, options = {}) same as []=, but you can supply options.
- 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.
- increment(key, amount = 1, options = {}) increment numeric value. This is an atomic operation
- decrement(key, amount = 1, options = {}) increment numeric value. This is an atomic operation
- create(key, value, options = {}) create entry. This is an atomic operation which is not supported by all stores.
- clear(options = {}) clear all keys in this store.
- close close database connection.
- features return array of features, e.g. [:create, :expires, :increment]
- supports?(feature) returns true if store supports a given feature
- Creating a Store
- However for Mongo and Couch this works
- The hash will be mapped directly to a Mongo/Couch document.
- Expiration
- Or using the builder…
- Expires in 60 seconds
- Never expire
- Update expires time if value is found
- Or remove the expiration if found
- Using the :expires option
- or manually by using the proxy…
- or using the builder…
- Atomic operations
- Atomic incrementation and raw access
- Atomic create
- Shared/distributed synchronization primitives
- Weak atomic operations
- Syntactic sugar and option merger
- All methods after 'with' get the options passed
- You can also specify the methods
- Syntactic sugar for raw access
- Access substore where all keys get a prefix
- Set expiration time for all keys
- Add proxies to existing store
- Framework Integration
- Rack
- Session store
- Use only the adapter name
- Use Moneta.new
- Use the Moneta builder
- Moneta middleware
- Add Rack::MonetaStore somewhere in your rack stack
- Pass it a block like the one passed to Moneta.build
- REST server
- Or pass it a block like the one passed to Moneta.build
- Rack-Cache
- Or used named Moneta stores
- Cookies
- Rails
- Session store
- Only by adapter name
- Use Moneta.new
- Use the Moneta builder
- Cache store
- Only by adapter name
- Use Moneta.new
- Use the Moneta builder
- Advanced
- Build your own key value server
- ToyStore ORM
- Use the Moneta Redis backend
- Testing and Benchmarks
- How to contribute?
- Contribute an adapter
- Alternatives
- Authors
-
SPEC
- Moneta Specification
- Class Methods
- new(options => {}) => Object
- Instance Methods
- [](key) => Object
- []=(key, value) => Object(value)
- fetch(key, options => {}, &block) => Object
- fetch(key, value, options => {}) => Object
- delete(key, options => {}) => Object
- key?(key, options => {}) => [TrueClass, FalseClass]
- store(key, value, options => {}) => Object(value)
- increment(key, amount = 1, options => {}) => Integer(value)
- decrement(key, amount = 1, options => {}) => Integer(value)
- create(key, value, options => {}) => [TrueClass, FalseClass]
- clear(options => {})
- close
- features => Array<Symbol> and supports?(Symbol) => [TrueClass, FalseClass]
- Additional Options Hashes
- Atomicity
Classes/Modules
Methods