moneta 0.7.20 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -5
- data/CHANGES +6 -0
- data/CONTRIBUTORS +2 -0
- data/Gemfile +31 -44
- data/LICENSE +1 -1
- data/README.md +82 -59
- data/lib/active_support/cache/moneta_store.rb +3 -3
- data/lib/moneta.rb +4 -2
- data/lib/moneta/adapters/activerecord.rb +8 -8
- data/lib/moneta/adapters/cassandra.rb +8 -8
- data/lib/moneta/adapters/couch.rb +1 -1
- data/lib/moneta/adapters/datamapper.rb +5 -5
- data/lib/moneta/adapters/daybreak.rb +1 -1
- data/lib/moneta/adapters/fog.rb +2 -2
- data/lib/moneta/adapters/lmdb.rb +1 -1
- data/lib/moneta/adapters/localmemcache.rb +1 -1
- data/lib/moneta/adapters/memcached/dalli.rb +3 -3
- data/lib/moneta/adapters/memcached/native.rb +1 -1
- data/lib/moneta/adapters/mongo.rb +6 -164
- data/lib/moneta/adapters/mongo/base.rb +63 -0
- data/lib/moneta/adapters/mongo/moped.rb +113 -0
- data/lib/moneta/adapters/mongo/official.rb +121 -0
- data/lib/moneta/adapters/pstore.rb +1 -5
- data/lib/moneta/adapters/restclient.rb +1 -1
- data/lib/moneta/adapters/sequel.rb +10 -10
- data/lib/moneta/cache.rb +1 -1
- data/lib/moneta/logger.rb +2 -2
- data/lib/moneta/mixins.rb +4 -4
- data/lib/moneta/shared.rb +2 -2
- data/lib/moneta/stack.rb +2 -2
- data/lib/moneta/synchronize.rb +2 -2
- data/lib/moneta/transformer.rb +5 -5
- data/lib/moneta/transformer/config.rb +38 -40
- data/lib/moneta/version.rb +1 -1
- data/lib/rack/cache/moneta.rb +1 -1
- data/lib/rack/moneta_cookies.rb +2 -2
- data/lib/rack/moneta_rest.rb +1 -1
- data/lib/rack/moneta_store.rb +4 -4
- data/lib/rack/session/moneta.rb +14 -2
- data/moneta.gemspec +1 -0
- data/script/benchmarks +97 -96
- data/script/generate-specs +763 -730
- data/script/install-bundle +1 -1
- data/script/install-kyotocabinet +2 -2
- data/script/memusage +1 -1
- data/script/upload-bundle +1 -1
- data/spec/action_dispatch/session_moneta_store_spec.rb +5 -5
- data/spec/active_support/cache_moneta_store_spec.rb +20 -20
- data/spec/moneta/adapter_activerecord_exisiting_connection_spec.rb +2 -2
- data/spec/moneta/adapter_activerecord_spec.rb +6 -6
- data/spec/moneta/adapter_cassandra_spec.rb +1 -1
- data/spec/moneta/adapter_cassandra_with_default_expires_spec.rb +1 -1
- data/spec/moneta/adapter_couch_spec.rb +1 -1
- data/spec/moneta/adapter_datamapper_spec.rb +6 -6
- data/spec/moneta/adapter_daybreak_spec.rb +1 -1
- data/spec/moneta/adapter_dbm_spec.rb +1 -1
- data/spec/moneta/adapter_file_spec.rb +1 -1
- data/spec/moneta/adapter_fog_spec.rb +4 -4
- data/spec/moneta/adapter_gdbm_spec.rb +1 -1
- data/spec/moneta/adapter_hbase_spec.rb +1 -1
- data/spec/moneta/adapter_kyotocabinet_spec.rb +1 -1
- data/spec/moneta/adapter_leveldb_spec.rb +1 -1
- data/spec/moneta/adapter_lmdb_spec.rb +1 -1
- data/spec/moneta/adapter_lmdb_with_db_spec.rb +1 -1
- data/spec/moneta/adapter_localmemcache_spec.rb +1 -1
- data/spec/moneta/adapter_lruhash_spec.rb +1 -1
- data/spec/moneta/adapter_memcached_dalli_spec.rb +1 -1
- data/spec/moneta/adapter_memcached_dalli_with_default_expires_spec.rb +1 -1
- data/spec/moneta/adapter_memcached_native_spec.rb +1 -1
- data/spec/moneta/adapter_memcached_native_with_default_expires_spec.rb +1 -1
- data/spec/moneta/adapter_memcached_spec.rb +1 -1
- data/spec/moneta/adapter_memcached_with_default_expires_spec.rb +1 -1
- data/spec/moneta/adapter_mongo_moped_spec.rb +56 -0
- data/spec/moneta/adapter_mongo_moped_with_default_expires_spec.rb +51 -0
- data/spec/moneta/adapter_mongo_official_spec.rb +56 -0
- data/spec/moneta/adapter_mongo_official_with_default_expires_spec.rb +51 -0
- data/spec/moneta/adapter_mongo_spec.rb +1 -7
- data/spec/moneta/adapter_mongo_with_default_expires_spec.rb +1 -1
- data/spec/moneta/adapter_pstore_spec.rb +1 -1
- data/spec/moneta/adapter_redis_with_default_expires_spec.rb +1 -1
- data/spec/moneta/adapter_restclient_spec.rb +1 -1
- data/spec/moneta/adapter_sdbm_spec.rb +1 -1
- data/spec/moneta/adapter_sequel_spec.rb +1 -1
- data/spec/moneta/adapter_sqlite_spec.rb +1 -1
- data/spec/moneta/adapter_tdb_spec.rb +1 -1
- data/spec/moneta/adapter_tokyocabinet_bdb_spec.rb +1 -1
- data/spec/moneta/adapter_tokyocabinet_hdb_spec.rb +1 -1
- data/spec/moneta/adapter_yaml_spec.rb +1 -1
- data/spec/moneta/cache_file_memory_spec.rb +1 -1
- data/spec/moneta/expires_file_spec.rb +3 -3
- data/spec/moneta/expires_memory_with_default_expires_spec.rb +1 -1
- data/spec/moneta/mutex_spec.rb +1 -1
- data/spec/moneta/optionmerger_spec.rb +26 -26
- data/spec/moneta/pool_spec.rb +1 -1
- data/spec/moneta/semaphore_spec.rb +1 -1
- data/spec/moneta/shared_tcp_spec.rb +2 -2
- data/spec/moneta/shared_unix_spec.rb +2 -2
- data/spec/moneta/stack_file_memory_spec.rb +1 -1
- data/spec/moneta/stack_memory_file_spec.rb +1 -1
- data/spec/moneta/standard_activerecord_spec.rb +1 -1
- data/spec/moneta/standard_activerecord_with_expires_spec.rb +1 -1
- data/spec/moneta/standard_cassandra_spec.rb +1 -1
- data/spec/moneta/standard_client_tcp_spec.rb +1 -1
- data/spec/moneta/standard_client_unix_spec.rb +2 -2
- data/spec/moneta/standard_couch_spec.rb +1 -1
- data/spec/moneta/standard_couch_with_expires_spec.rb +1 -1
- data/spec/moneta/standard_datamapper_spec.rb +2 -2
- data/spec/moneta/standard_datamapper_with_expires_spec.rb +2 -2
- data/spec/moneta/standard_datamapper_with_repository_spec.rb +2 -2
- data/spec/moneta/standard_daybreak_spec.rb +1 -1
- data/spec/moneta/standard_daybreak_with_expires_spec.rb +1 -1
- data/spec/moneta/standard_dbm_spec.rb +1 -1
- data/spec/moneta/standard_dbm_with_expires_spec.rb +1 -1
- data/spec/moneta/standard_file_spec.rb +1 -1
- data/spec/moneta/standard_file_with_expires_spec.rb +1 -1
- data/spec/moneta/standard_fog_spec.rb +4 -4
- data/spec/moneta/standard_fog_with_expires_spec.rb +5 -5
- data/spec/moneta/standard_gdbm_spec.rb +1 -1
- data/spec/moneta/standard_gdbm_with_expires_spec.rb +1 -1
- data/spec/moneta/standard_hashfile_spec.rb +1 -1
- data/spec/moneta/standard_hashfile_with_expires_spec.rb +1 -1
- data/spec/moneta/standard_hbase_spec.rb +1 -1
- data/spec/moneta/standard_hbase_with_expires_spec.rb +1 -1
- data/spec/moneta/standard_kyotocabinet_spec.rb +1 -1
- data/spec/moneta/standard_kyotocabinet_with_expires_spec.rb +1 -1
- data/spec/moneta/standard_leveldb_spec.rb +1 -1
- data/spec/moneta/standard_leveldb_with_expires_spec.rb +1 -1
- data/spec/moneta/standard_lmdb_spec.rb +1 -1
- data/spec/moneta/standard_lmdb_with_expires_spec.rb +1 -1
- data/spec/moneta/standard_localmemcache_spec.rb +1 -1
- data/spec/moneta/standard_localmemcache_with_expires_spec.rb +1 -1
- data/spec/moneta/standard_lruhash_spec.rb +1 -1
- data/spec/moneta/standard_lruhash_with_expires_spec.rb +1 -1
- data/spec/moneta/standard_memcached_dalli_spec.rb +1 -1
- data/spec/moneta/standard_memcached_native_spec.rb +1 -1
- data/spec/moneta/standard_memcached_spec.rb +1 -1
- data/spec/moneta/standard_memory_spec.rb +1 -1
- data/spec/moneta/standard_memory_with_compress_spec.rb +1 -1
- data/spec/moneta/standard_memory_with_expires_spec.rb +1 -1
- data/spec/moneta/standard_memory_with_json_key_serializer_spec.rb +1 -1
- data/spec/moneta/standard_memory_with_json_serializer_spec.rb +1 -1
- data/spec/moneta/standard_memory_with_json_value_serializer_spec.rb +1 -1
- data/spec/moneta/standard_memory_with_prefix_spec.rb +1 -1
- data/spec/moneta/standard_memory_with_snappy_compress_spec.rb +1 -1
- data/spec/moneta/standard_mongo_moped_spec.rb +255 -0
- data/spec/moneta/standard_mongo_official_spec.rb +255 -0
- data/spec/moneta/standard_mongo_spec.rb +1 -1
- data/spec/moneta/standard_null_spec.rb +1 -1
- data/spec/moneta/standard_pstore_spec.rb +1 -1
- data/spec/moneta/standard_pstore_with_expires_spec.rb +1 -1
- data/spec/moneta/standard_redis_spec.rb +1 -1
- data/spec/moneta/standard_restclient_spec.rb +1 -1
- data/spec/moneta/standard_riak_spec.rb +1 -1
- data/spec/moneta/standard_riak_with_expires_spec.rb +1 -1
- data/spec/moneta/standard_sdbm_spec.rb +1 -1
- data/spec/moneta/standard_sdbm_with_expires_spec.rb +1 -1
- data/spec/moneta/standard_sequel_spec.rb +1 -1
- data/spec/moneta/standard_sequel_with_expires_spec.rb +1 -1
- data/spec/moneta/standard_sqlite_spec.rb +1 -1
- data/spec/moneta/standard_sqlite_with_expires_spec.rb +1 -1
- data/spec/moneta/standard_tdb_spec.rb +1 -1
- data/spec/moneta/standard_tdb_with_expires_spec.rb +1 -1
- data/spec/moneta/standard_tokyocabinet_spec.rb +1 -1
- data/spec/moneta/standard_tokyocabinet_with_expires_spec.rb +1 -1
- data/spec/moneta/standard_tokyotyrant_spec.rb +1 -1
- data/spec/moneta/standard_tokyotyrant_with_expires_spec.rb +1 -1
- data/spec/moneta/standard_yaml_spec.rb +1 -1
- data/spec/moneta/standard_yaml_with_expires_spec.rb +1 -1
- data/spec/moneta/transformer_bencode_spec.rb +1 -1
- data/spec/moneta/transformer_bert_spec.rb +1 -1
- data/spec/moneta/transformer_bson_spec.rb +1 -1
- data/spec/moneta/transformer_bzip2_spec.rb +1 -1
- data/spec/moneta/transformer_json_spec.rb +1 -1
- data/spec/moneta/transformer_key_inspect_spec.rb +1 -1
- data/spec/moneta/transformer_key_marshal_spec.rb +1 -1
- data/spec/moneta/transformer_key_to_s_spec.rb +1 -1
- data/spec/moneta/transformer_key_yaml_spec.rb +1 -1
- data/spec/moneta/transformer_lz4_spec.rb +1 -1
- data/spec/moneta/transformer_lzma_spec.rb +1 -1
- data/spec/moneta/transformer_lzo_spec.rb +1 -1
- data/spec/moneta/transformer_marshal_base64_spec.rb +1 -1
- data/spec/moneta/transformer_marshal_city128_spec.rb +1 -1
- data/spec/moneta/transformer_marshal_city32_spec.rb +1 -1
- data/spec/moneta/transformer_marshal_city64_spec.rb +1 -1
- data/spec/moneta/transformer_marshal_escape_spec.rb +1 -1
- data/spec/moneta/transformer_marshal_hex_spec.rb +1 -1
- data/spec/moneta/transformer_marshal_hmac_spec.rb +1 -1
- data/spec/moneta/transformer_marshal_md5_spec.rb +1 -1
- data/spec/moneta/transformer_marshal_md5_spread_spec.rb +1 -1
- data/spec/moneta/transformer_marshal_prefix_spec.rb +1 -1
- data/spec/moneta/transformer_marshal_qp_spec.rb +1 -1
- data/spec/moneta/transformer_marshal_rmd160_spec.rb +1 -1
- data/spec/moneta/transformer_marshal_sha1_spec.rb +1 -1
- data/spec/moneta/transformer_marshal_sha256_spec.rb +1 -1
- data/spec/moneta/transformer_marshal_sha384_spec.rb +1 -1
- data/spec/moneta/transformer_marshal_sha512_spec.rb +1 -1
- data/spec/moneta/transformer_marshal_spec.rb +1 -1
- data/spec/moneta/transformer_marshal_truncate_spec.rb +1 -1
- data/spec/moneta/transformer_marshal_uuencode_spec.rb +1 -1
- data/spec/moneta/transformer_msgpack_spec.rb +1 -1
- data/spec/moneta/transformer_ox_spec.rb +1 -1
- data/spec/moneta/transformer_php_spec.rb +1 -1
- data/spec/moneta/transformer_quicklz_spec.rb +1 -1
- data/spec/moneta/transformer_snappy_spec.rb +1 -1
- data/spec/moneta/transformer_tnet_spec.rb +1 -1
- data/spec/moneta/transformer_value_marshal_spec.rb +1 -1
- data/spec/moneta/transformer_value_yaml_spec.rb +1 -1
- data/spec/moneta/transformer_yaml_spec.rb +1 -1
- data/spec/moneta/transformer_zlib_spec.rb +1 -1
- data/spec/moneta/weak_create_spec.rb +4 -4
- data/spec/moneta/weak_increment_spec.rb +4 -4
- data/spec/monetaspecs.rb +481 -481
- metadata +14 -185
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 642e4643f1753537b4510ce0a47cbdbdfb65ebf2
|
4
|
+
data.tar.gz: 807acd8640b3ae0a78ae725062a6412a2e82b188
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 043562b273cffcb3d165412bc9fb20524a88f05b7c39e3dc26e1982a3ad3f63c8583564ceeb169b553bd33979b821183f40edd1a5ce66a9840533655e84445ea
|
7
|
+
data.tar.gz: 8d47b90c541c2917a4a05aa5ee896140052d94119aabdea1ba87d88865ed531d11488b8fbcf2efef11f88d5b805f6e5024be8ea58ce05233a0d25f11e0a0ff55
|
data/.travis.yml
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
+
- 2.1.0
|
3
4
|
- 2.0.0
|
4
5
|
- 1.9.3
|
5
|
-
- 1.8.7
|
6
6
|
- jruby-19mode
|
7
|
-
- jruby-18mode
|
8
7
|
- rbx-19mode
|
9
|
-
- rbx-18mode
|
10
8
|
before_install:
|
11
9
|
#- script/install-kyotocabinet
|
12
10
|
- sudo apt-get install -qq libtokyocabinet8 libtokyocabinet-dev liblzo2-dev libtdb-dev libleveldb-dev tokyotyrant
|
@@ -42,9 +40,7 @@ env:
|
|
42
40
|
- "SCRIPT='benchmarks normal_large'"
|
43
41
|
matrix:
|
44
42
|
allow_failures:
|
45
|
-
- rvm: jruby-18mode
|
46
43
|
- rvm: jruby-19mode
|
47
|
-
- rvm: rbx-18mode
|
48
44
|
- rvm: rbx-19mode
|
49
45
|
- env: "SCRIPT='parallel-tests unstable'"
|
50
46
|
script: "eval bundle exec ruby script/$SCRIPT"
|
data/CHANGES
CHANGED
data/CONTRIBUTORS
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
Adrian Madrid <aemadrid@gmail.com>
|
2
2
|
Alejandro Crosa <acrosa@sharing.local>
|
3
3
|
Anthony Eden <anthonyeden@gmail.com>
|
4
|
+
AtoxIO <atoxhybrid@gmail.com>
|
4
5
|
Benjamin Yu <benjaminlyu@gmail.com>
|
5
6
|
Ben Schwarz <ben.schwarz@gmail.com>
|
6
7
|
Daniel Mendler <mail@daniel-mendler.de>
|
8
|
+
Denis Defreyne <denis.defreyne@stoneship.org>
|
7
9
|
Derek Kastner <dkastner@gmail.com>
|
8
10
|
Dylan Egan <me@dylanegan.com>
|
9
11
|
Hampton Catlin <hcatlin@gmail.com>
|
data/Gemfile
CHANGED
@@ -1,10 +1,3 @@
|
|
1
|
-
# Rails 4 requires Ruby >= 1.9
|
2
|
-
def rails_version
|
3
|
-
v = ['>= 3.2.11']
|
4
|
-
v << '< 4.0.0' unless RUBY_VERSION >= '1.9'
|
5
|
-
v
|
6
|
-
end
|
7
|
-
|
8
1
|
source 'https://rubygems.org'
|
9
2
|
gemspec
|
10
3
|
|
@@ -16,26 +9,26 @@ gem 'rspec-retry'
|
|
16
9
|
gem 'tnetstring'
|
17
10
|
gem 'bencode'
|
18
11
|
gem 'multi_json'
|
19
|
-
gem 'bson_ext', :
|
20
|
-
gem 'bson', :
|
21
|
-
gem 'ox', :
|
22
|
-
gem 'msgpack', :
|
23
|
-
gem 'msgpack-jruby', :
|
24
|
-
gem 'bert', :
|
12
|
+
gem 'bson_ext', platforms: :ruby
|
13
|
+
gem 'bson', platforms: :jruby
|
14
|
+
gem 'ox', platforms: :ruby
|
15
|
+
gem 'msgpack', platforms: :ruby
|
16
|
+
gem 'msgpack-jruby', platforms: :jruby
|
17
|
+
gem 'bert', platforms: :ruby
|
25
18
|
gem 'php_serialize'
|
26
19
|
|
27
20
|
# Compressors used by Transformer
|
28
21
|
if RUBY_VERSION < '2.0'
|
29
|
-
gem 'bzip2-ruby', :
|
22
|
+
gem 'bzip2-ruby', platforms: :mri # Only on mri currently
|
30
23
|
end
|
31
|
-
gem 'lz4-ruby', :
|
32
|
-
gem 'ruby-lzma', :
|
33
|
-
gem 'lzoruby', :
|
34
|
-
gem 'snappy', :
|
35
|
-
gem 'qlzruby', :
|
24
|
+
gem 'lz4-ruby', platforms: :ruby
|
25
|
+
gem 'ruby-lzma', platforms: :ruby
|
26
|
+
gem 'lzoruby', platforms: :ruby
|
27
|
+
gem 'snappy', platforms: :ruby
|
28
|
+
gem 'qlzruby', platforms: :ruby
|
36
29
|
|
37
30
|
# Hash transformer library
|
38
|
-
gem 'cityhash', :
|
31
|
+
gem 'cityhash', platforms: :ruby
|
39
32
|
|
40
33
|
# Backends
|
41
34
|
gem 'faraday'
|
@@ -44,50 +37,44 @@ gem 'dm-core'
|
|
44
37
|
gem 'dm-migrations'
|
45
38
|
gem 'dm-mysql-adapter'
|
46
39
|
# FIXME: Use fog master because of failing tests, fixed after 1.11.1
|
47
|
-
gem 'fog', :
|
48
|
-
gem 'activerecord',
|
40
|
+
gem 'fog', github: 'fog/fog'
|
41
|
+
gem 'activerecord', '>= 3.2.11'
|
49
42
|
gem 'redis'
|
50
43
|
gem 'mongo'
|
44
|
+
gem 'moped'
|
51
45
|
gem 'sequel'
|
52
46
|
gem 'dalli'
|
53
47
|
gem 'riak-client'
|
54
48
|
gem 'cassandra'
|
55
49
|
gem 'tokyotyrant'
|
56
|
-
#gem 'ruby-tokyotyrant', :
|
50
|
+
#gem 'ruby-tokyotyrant', platforms: :ruby
|
57
51
|
#gem 'hbaserb'
|
58
52
|
#gem 'localmemcache'
|
59
|
-
gem 'tdb', :
|
60
|
-
gem 'leveldb-ruby', :
|
61
|
-
|
62
|
-
gem 'lmdb', :platforms => :mri
|
63
|
-
end
|
53
|
+
gem 'tdb', platforms: :ruby
|
54
|
+
gem 'leveldb-ruby', platforms: :ruby
|
55
|
+
gem 'lmdb', platforms: :mri
|
64
56
|
if RUBY_VERSION < '2.0'
|
65
|
-
gem 'tokyocabinet', :
|
57
|
+
gem 'tokyocabinet', platforms: :ruby
|
66
58
|
end
|
67
59
|
#if RUBY_VERSION < '2.0' && !defined?(JRUBY_VERSION)
|
68
60
|
# FIXME: We have to check manually for jruby
|
69
61
|
# otherwise bundle install --deployment doesn't work
|
70
|
-
# gem 'kyotocabinet-ruby', :
|
62
|
+
# gem 'kyotocabinet-ruby', github: 'minad/kyotocabinet-ruby'
|
71
63
|
#end
|
72
|
-
gem 'memcached', :
|
73
|
-
gem 'jruby-memcached', :
|
74
|
-
gem 'sqlite3', :
|
75
|
-
gem 'activerecord-jdbc-adapter', :
|
76
|
-
gem 'activerecord-jdbcmysql-adapter', :
|
77
|
-
gem 'mysql2', '>= 0.3.12b5', :
|
64
|
+
gem 'memcached', platforms: :ruby
|
65
|
+
gem 'jruby-memcached', platforms: :jruby
|
66
|
+
gem 'sqlite3', platforms: :ruby
|
67
|
+
gem 'activerecord-jdbc-adapter', platforms: :jruby
|
68
|
+
gem 'activerecord-jdbcmysql-adapter', platforms: :jruby
|
69
|
+
gem 'mysql2', '>= 0.3.12b5', platforms: :ruby
|
78
70
|
# gdbm for jruby needs ffi
|
79
|
-
gem 'ffi', :
|
80
|
-
gem 'gdbm', :
|
71
|
+
gem 'ffi', platforms: :jruby
|
72
|
+
gem 'gdbm', platforms: :jruby
|
81
73
|
|
82
74
|
# Rack integration testing
|
83
75
|
gem 'rack'
|
84
76
|
gem 'rack-cache'
|
85
77
|
|
86
78
|
# Rails integration testing
|
87
|
-
gem 'actionpack',
|
79
|
+
gem 'actionpack', '>= 3.2.11'
|
88
80
|
gem 'minitest', '~> 4.7.4'
|
89
|
-
|
90
|
-
# Fix versions for old ruby 1.8
|
91
|
-
if RUBY_VERSION < '1.9'
|
92
|
-
gem 'nokogiri', '< 1.6'
|
93
|
-
end
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Moneta: A unified interface for key/value stores
|
2
2
|
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/moneta.png)](http://rubygems.org/gems/moneta) [![Build Status](https://secure.travis-ci.org/minad/moneta.png?branch=master)](http://travis-ci.org/minad/moneta) [![Dependency Status](https://gemnasium.com/minad/moneta.png?travis)](https://gemnasium.com/minad/moneta) [![Code Climate](https://codeclimate.com/github/minad/moneta.png)](https://codeclimate.com/github/minad/moneta)
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/moneta.png)](http://rubygems.org/gems/moneta) [![Build Status](https://secure.travis-ci.org/minad/moneta.png?branch=master)](http://travis-ci.org/minad/moneta) [![Dependency Status](https://gemnasium.com/minad/moneta.png?travis)](https://gemnasium.com/minad/moneta) [![Code Climate](https://codeclimate.com/github/minad/moneta.png)](https://codeclimate.com/github/minad/moneta) [![Gittip donate button](http://img.shields.io/gittip/bevry.png)](https://www.gittip.com/min4d/ "Donate weekly to this project using Gittip")
|
4
|
+
[![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=min4d&url=https://github.com/minad/moneta&title=Moneta&language=&tags=github&category=software)
|
4
5
|
|
5
6
|
Moneta provides a standard interface for interacting with various kinds of key/value stores. Moneta supports the well-known
|
6
7
|
NoSQL and document based stores.
|
@@ -18,7 +19,7 @@ A short overview of the features:
|
|
18
19
|
* Atomic creation of entries (Method `#create`)
|
19
20
|
* Shared/distributed database-wide synchronization primitives `Moneta::Mutex` and `Moneta::Semaphore`
|
20
21
|
* Includes a simple pure-ruby key/value server (`Moneta::Server`) and client (`Moneta::Adapters::Client`)
|
21
|
-
* Integration with [Rails](http://rubyonrails.org/), [Rack](http://rack.github.com/)/[Rack-Cache](https://github.com/rtomayko/rack-cache), [Sinatra](http://sinatrarb.com/) and [Ramaze](http://ramaze.net/).
|
22
|
+
* Integration with [Rails](http://rubyonrails.org/), [Rack](http://rack.github.com/)/[Rack-Cache](https://github.com/rtomayko/rack-cache), [Sinatra](http://sinatrarb.com/), [Padrino](http://padrinorb.com) and [Ramaze](http://ramaze.net/).
|
22
23
|
|
23
24
|
If you are not yet convinced, you might ask why? What are the goals of the project?
|
24
25
|
|
@@ -28,7 +29,6 @@ same for template languages.
|
|
28
29
|
* To hide a lot of different and maybe complex APIs behind one well-designed and simple Moneta API
|
29
30
|
* Give people a starting point or example code to start working with their favourite key/value store. Feel free to copy code, please mention Moneta then :)
|
30
31
|
* Create a reusable piece of code, since similar things are solved over and over again ([Rails](http://rubyonrails.org/) brings its own cache stores, and many frameworks do the same...)
|
31
|
-
* See also http://yehudakatz.com/2009/02/12/whats-the-point/
|
32
32
|
|
33
33
|
Moneta is tested thoroughly using [Travis-CI](http://travis-ci.org/minad/moneta).
|
34
34
|
|
@@ -54,7 +54,7 @@ Now you are ready to go:
|
|
54
54
|
require 'moneta'
|
55
55
|
|
56
56
|
# Create a simple file store
|
57
|
-
store = Moneta.new(:File, :
|
57
|
+
store = Moneta.new(:File, dir: 'moneta')
|
58
58
|
|
59
59
|
# Store some entries
|
60
60
|
store['key'] = 'value'
|
@@ -115,7 +115,7 @@ Out of the box, it supports the following backends. Use the backend name symbol
|
|
115
115
|
* [Simple Samba database TDB](http://tdb.samba.org/) (`:TDB`)
|
116
116
|
* Document databases:
|
117
117
|
* [CouchDB](http://couchdb.apache.org/) (`:Couch`)
|
118
|
-
* [MongoDB](http://www.mongodb.org/) (`:Mongo`)
|
118
|
+
* [MongoDB](http://www.mongodb.org/) (`:Mongo`, `:MongoOffical` or `:MongoMoped`)
|
119
119
|
* Moneta network protocols:
|
120
120
|
* Moneta key/value client (`:Client` works with `Moneta::Server`)
|
121
121
|
* Moneta HTTP/REST client (`:RestClient` works with `Rack::MonetaRest`)
|
@@ -130,7 +130,7 @@ to upgrade to a real key/value store.
|
|
130
130
|
|
131
131
|
### Backend feature matrix
|
132
132
|
|
133
|
-
__NOTE:__ <a name="backend-matrix">The backend matrix
|
133
|
+
__NOTE:__ <a name="backend-matrix"></a>The backend matrix is much more readable on rubydoc.info than on github. [Go there!](http://rubydoc.info/github/minad/moneta/master/file/README.md#backend-matrix)
|
134
134
|
|
135
135
|
<table>
|
136
136
|
|
@@ -138,7 +138,11 @@ __NOTE:__ <a name="backend-matrix">The backend matrix</a> is much more readable
|
|
138
138
|
|
139
139
|
<tr><th colspan="2">Persistent stores</th><th colspan="7"></th></tr>
|
140
140
|
|
141
|
-
<tr><td>Mongo</td><td>mongo</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td><a href="http://www.mongodb.org/">MongoDB</a> database</td></tr>
|
141
|
+
<tr><td>Mongo</td><td>mongo or moped</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td><a href="http://www.mongodb.org/">MongoDB</a> database</td></tr>
|
142
|
+
|
143
|
+
<tr><td>MongoOfficial</td><td>mongo</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td><a href="http://www.mongodb.org/">MongoDB</a> database</td></tr>
|
144
|
+
|
145
|
+
<tr><td>MongoMoped</td><td>moped</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td><a href="http://www.mongodb.org/">MongoDB</a> database</td></tr>
|
142
146
|
|
143
147
|
<tr><td>Redis</td><td>redis</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td><a href="http://redis.io/">Redis</a> database</td></tr>
|
144
148
|
|
@@ -210,9 +214,9 @@ __NOTE:__ <a name="backend-matrix">The backend matrix</a> is much more readable
|
|
210
214
|
|
211
215
|
</table>
|
212
216
|
|
213
|
-
* [1]: Make adapters thread-safe by using `Moneta::Lock` or by passing the option
|
217
|
+
* [1]: Make adapters thread-safe by using `Moneta::Lock` or by passing the option `threadsafe: true` to `Moneta#new`. There is also `Moneta::Pool` which can be used to share a store between multiple threads if the store is multi-process safe. I recommend to add the option `:threadsafe` to ensure thread-safety since for example under JRuby and Rubinius even the basic datastructures are not thread safe due to the lack of a global interpreter lock (GIL). This differs from MRI where some adapters might appear thread safe already but only due to the GIL.
|
214
218
|
* [2]: Share a Moneta store between multiple processes using `Moneta::Shared` (See below).
|
215
|
-
* [3]: Add expiration support by using `Moneta::Expires` or by passing the option
|
219
|
+
* [3]: Add expiration support by using `Moneta::Expires` or by passing the option `expires: true` to `Moneta#new`.
|
216
220
|
* [4]: There are some servers which use the memcached protocol but which are persistent (e.g. [MemcacheDB](http://memcachedb.org/), [Kai](http://sourceforge.net/apps/mediawiki/kai), [IronCache](http://dev.iron.io/cache/reference/memcache/), [Roma](https://github.com/roma/roma/tree), [Flare](http://labs.gree.jp/Top/OpenSource/Flare-en.html) and [Kumofs](https://github.com/etolabo/kumofs))
|
217
221
|
* [5]: Depends on server
|
218
222
|
* [6]: Store is multi-process safe because it is an in-memory store, values are not shared between multiple processes
|
@@ -334,9 +338,9 @@ This allows you to store arbitrary Ruby objects. You can tune some options
|
|
334
338
|
when you call `Moneta.new`. However for very fine tuning use `Moneta.build`.
|
335
339
|
|
336
340
|
~~~ ruby
|
337
|
-
store = Moneta.new(:Memcached, :
|
341
|
+
store = Moneta.new(:Memcached, server: 'localhost:11211')
|
338
342
|
store['key'] = 'value'
|
339
|
-
store['hash_key'] = {:
|
343
|
+
store['hash_key'] = {a: 1, b: 2}
|
340
344
|
store['object_key'] = MarshallableRubyObject.new
|
341
345
|
~~~
|
342
346
|
|
@@ -348,7 +352,7 @@ store = Moneta.build do
|
|
348
352
|
use :Expires
|
349
353
|
|
350
354
|
# Transform key using Marshal and Base64 and value using Marshal
|
351
|
-
use :Transformer, :
|
355
|
+
use :Transformer, key: [:marshal, :base64], value: :marshal
|
352
356
|
|
353
357
|
# IMPORTANT: adapter must be defined last for the builder to function properly.
|
354
358
|
|
@@ -361,16 +365,16 @@ You can also directly access the underlying adapters if you don't want
|
|
361
365
|
to use the Moneta stack.
|
362
366
|
|
363
367
|
~~~ ruby
|
364
|
-
db = Moneta::Adapters::File.new(:
|
365
|
-
db['key'] = {:
|
368
|
+
db = Moneta::Adapters::File.new(dir: 'directory')
|
369
|
+
db['key'] = {a: 1, b: 2} # This will fail since you can only store Strings
|
366
370
|
|
367
371
|
# However for Mongo and Couch this works
|
368
372
|
# The hash will be mapped directly to a Mongo/Couch document.
|
369
373
|
db = Moneta::Adapters::Couch.new
|
370
|
-
db['key'] = {:
|
374
|
+
db['key'] = {a: 1, b: 2}
|
371
375
|
|
372
376
|
db = Moneta::Adapters::Mongo.new
|
373
|
-
db['key'] = {:
|
377
|
+
db['key'] = {a: 1, b: 2}
|
374
378
|
~~~
|
375
379
|
|
376
380
|
### Expiration
|
@@ -386,19 +390,19 @@ cache = Moneta.build do
|
|
386
390
|
end
|
387
391
|
|
388
392
|
# Expires in 60 seconds
|
389
|
-
cache.store(key, value, :
|
393
|
+
cache.store(key, value, expires: 60)
|
390
394
|
|
391
395
|
# Never expire
|
392
|
-
cache.store(key, value, :
|
393
|
-
cache.store(key, value, :
|
396
|
+
cache.store(key, value, expires: 0)
|
397
|
+
cache.store(key, value, expires: false)
|
394
398
|
|
395
399
|
# Update expires time if value is found
|
396
|
-
cache.load(key, :
|
397
|
-
cache.key?(key, :
|
400
|
+
cache.load(key, expires: 30)
|
401
|
+
cache.key?(key, expires: 30)
|
398
402
|
|
399
403
|
# Or remove the expiration if found
|
400
|
-
cache.load(key, :
|
401
|
-
cache.key?(key, :
|
404
|
+
cache.load(key, expires: false)
|
405
|
+
cache.key?(key, expires: 0)
|
402
406
|
~~~
|
403
407
|
|
404
408
|
You can add the expires feature to other backends using the `Moneta::Expires` proxy. But be aware
|
@@ -406,15 +410,15 @@ that expired values are not deleted automatically if they are not looked up.
|
|
406
410
|
|
407
411
|
~~~ ruby
|
408
412
|
# Using the :expires option
|
409
|
-
cache = Moneta.new(:File, :
|
413
|
+
cache = Moneta.new(:File, dir: '...', expires: true)
|
410
414
|
|
411
415
|
# or manually by using the proxy...
|
412
|
-
cache = Moneta::Expires.new(Moneta::Adapters::File.new(:
|
416
|
+
cache = Moneta::Expires.new(Moneta::Adapters::File.new(dir: '...'))
|
413
417
|
|
414
418
|
# or using the builder...
|
415
419
|
cache = Moneta.build do
|
416
420
|
use :Expires
|
417
|
-
adapter :File, :
|
421
|
+
adapter :File, dir: '...'
|
418
422
|
end
|
419
423
|
~~~
|
420
424
|
|
@@ -441,9 +445,9 @@ if you have a `Moneta::Transformer` somewhere in your proxy stack which transfor
|
|
441
445
|
|
442
446
|
~~~ ruby
|
443
447
|
store.increment('counter') # returns 1, counter created
|
444
|
-
store.load('counter', :
|
448
|
+
store.load('counter', raw: true) # returns 1
|
445
449
|
|
446
|
-
store.store('counter', '10', :
|
450
|
+
store.store('counter', '10', raw: true)
|
447
451
|
store.increment('counter') # returns 11
|
448
452
|
~~~
|
449
453
|
|
@@ -540,11 +544,11 @@ For raw data access as described before the class `Moneta::OptionMerger` is used
|
|
540
544
|
|
541
545
|
~~~ ruby
|
542
546
|
# All methods after 'with' get the options passed
|
543
|
-
store.with(:
|
547
|
+
store.with(raw: true).load('key')
|
544
548
|
|
545
549
|
# You can also specify the methods
|
546
|
-
store.with(:
|
547
|
-
store.with(:
|
550
|
+
store.with(raw: true, only: :load).load('key')
|
551
|
+
store.with(raw: true, except: [:key?, :increment]).load('key')
|
548
552
|
|
549
553
|
# Syntactic sugar for raw access
|
550
554
|
store.raw.load('key')
|
@@ -565,8 +569,8 @@ short_lived_store['key'] = 'value'
|
|
565
569
|
You can add proxies to an existing store. This is useful if you want to compress only a few values for example.
|
566
570
|
|
567
571
|
~~~ ruby
|
568
|
-
compressed_store = store.with(:
|
569
|
-
use :Transformer, :
|
572
|
+
compressed_store = store.with(prefix: 'compressed') do
|
573
|
+
use :Transformer, value: :zlib
|
570
574
|
end
|
571
575
|
|
572
576
|
store['key'] = 'this value will not be compressed'
|
@@ -579,18 +583,19 @@ compressed_store['key'] = 'value will be compressed'
|
|
579
583
|
|
580
584
|
Inspired by [redis-store](https://github.com/jodosha/redis-store) there exist integration classes for [Rails](http://rubyonrails.org/) and [Rack](http://rack.github.com/)/[Rack-Cache](https://github.com/rtomayko/rack-cache). You can also use all the Rack middlewares together with Rails and the [Sinatra](http://sinatrarb.com/) framework. There exist the following integration classes:
|
581
585
|
|
582
|
-
* Rack, Rails and Sinatra
|
586
|
+
* [Rack](http://rack.github.com/), [Rails](http://rubyonrails.org/) and [Sinatra](http://sinatrarb.com/)
|
583
587
|
* `Rack::Session::Moneta` is a Rack middleware to use Moneta for storing sessions
|
584
588
|
* `Rack::MonetaStore` is a Rack middleware which places a Moneta store in the environment and enables per-request caching
|
585
589
|
* `Rack::MonetaCookies` is a Rack middleware which uses Moneta to store cookies
|
586
590
|
* `Rack::MonetaRest` is a Rack application which exposes a Moneta store via REST/HTTP
|
587
591
|
* `Rack::Cache::Moneta` provides meta and entity stores for Rack-Cache
|
588
|
-
* Rails
|
592
|
+
* [Rails](http://rubyonrails.org/)
|
589
593
|
* `ActionDispatch::Session::MonetaStore` is a Rails middleware to use Moneta for storing sessions
|
590
594
|
* `ActiveSupport::Cache::MonetaStore` is a Rails cache implementation which uses a Moneta store as backend
|
591
|
-
* Ramaze
|
592
|
-
* `Ramaze::Cache::Moneta` is integrated into the
|
595
|
+
* [Ramaze](http://ramaze.net/)
|
596
|
+
* `Ramaze::Cache::Moneta` is integrated into the Ramaze project and allows Ramaze to use
|
593
597
|
Moneta as caching store
|
598
|
+
* [Padrino](http://padrinorb.com) adopted Moneta to replace their cache stores in padrino-cache.
|
594
599
|
|
595
600
|
### Rack
|
596
601
|
|
@@ -602,10 +607,17 @@ You can use Moneta as a [Rack](http://rack.github.com/) session store. Use it in
|
|
602
607
|
require 'rack/session/moneta'
|
603
608
|
|
604
609
|
# Use only the adapter name
|
605
|
-
use Rack::Session::Moneta, :
|
610
|
+
use Rack::Session::Moneta, store: :Redis
|
606
611
|
|
607
612
|
# Use Moneta.new
|
608
|
-
use Rack::Session::Moneta, :
|
613
|
+
use Rack::Session::Moneta, store: Moneta.new(:Memory, expires: true)
|
614
|
+
|
615
|
+
# Set rack options
|
616
|
+
use Rack::Session::Moneta, key: 'rack.session',
|
617
|
+
domain: 'foo.com',
|
618
|
+
path: '/',
|
619
|
+
expire_after: 2592000,
|
620
|
+
store: Moneta.new(:Memory, expires: true)
|
609
621
|
|
610
622
|
# Use the Moneta builder
|
611
623
|
use Rack::Session::Moneta do
|
@@ -617,11 +629,11 @@ end
|
|
617
629
|
#### Moneta middleware
|
618
630
|
|
619
631
|
There is a simple middleware which places a Moneta store in the Rack environment at `env['rack.moneta_store']`. It supports per-request
|
620
|
-
caching if you add the option
|
632
|
+
caching if you add the option `cache: true`. Use it in your `config.ru` like this:
|
621
633
|
|
622
634
|
~~~ ruby
|
623
635
|
# Add Rack::MonetaStore somewhere in your rack stack
|
624
|
-
use Rack::MonetaStore, :Memory, :
|
636
|
+
use Rack::MonetaStore, :Memory, cache: true
|
625
637
|
|
626
638
|
run lambda { |env|
|
627
639
|
env['rack.moneta_store'] # is a Moneta store with per-request caching
|
@@ -629,7 +641,7 @@ run lambda { |env|
|
|
629
641
|
|
630
642
|
# Pass it a block like the one passed to Moneta.build
|
631
643
|
use Rack::MonetaStore do
|
632
|
-
use :Transformer, :
|
644
|
+
use :Transformer, value: :zlib
|
633
645
|
adapter :Cookie
|
634
646
|
end
|
635
647
|
|
@@ -651,7 +663,7 @@ end
|
|
651
663
|
|
652
664
|
# Or pass it a block like the one passed to Moneta.build
|
653
665
|
run Rack::MonetaRest.new do
|
654
|
-
use :Transformer, :
|
666
|
+
use :Transformer, value: :zlib
|
655
667
|
adapter :Memory
|
656
668
|
end
|
657
669
|
~~~
|
@@ -664,8 +676,8 @@ You can use Moneta as a [Rack-Cache](https://github.com/rtomayko/rack-cache) sto
|
|
664
676
|
require 'rack/cache/moneta'
|
665
677
|
|
666
678
|
use Rack::Cache,
|
667
|
-
:
|
668
|
-
:
|
679
|
+
metastore: 'moneta://Memory?expires=true',
|
680
|
+
entitystore: 'moneta://Memory?expires=true'
|
669
681
|
|
670
682
|
# Or used named Moneta stores
|
671
683
|
Rack::Cache::Moneta['named_metastore'] = Moneta.build do
|
@@ -673,8 +685,8 @@ Rack::Cache::Moneta['named_metastore'] = Moneta.build do
|
|
673
685
|
adapter :Memory
|
674
686
|
end
|
675
687
|
use Rack::Cache,
|
676
|
-
:
|
677
|
-
:
|
688
|
+
metastore: 'moneta://named_metastore',
|
689
|
+
entity_store: 'moneta://named_entitystore'
|
678
690
|
~~~
|
679
691
|
|
680
692
|
#### Cookies
|
@@ -686,7 +698,7 @@ to use all the transformers on the cookies (e.g. `:prefix`, `:marshal` and `:hma
|
|
686
698
|
~~~ ruby
|
687
699
|
require 'rack/moneta_cookies'
|
688
700
|
|
689
|
-
use Rack::MonetaCookies, :
|
701
|
+
use Rack::MonetaCookies, domain: 'example.com', path: '/path'
|
690
702
|
run lambda { |env|
|
691
703
|
req = Rack::Request.new(env)
|
692
704
|
req.cookies #=> is now a Moneta store!
|
@@ -708,13 +720,13 @@ Add the session store in your application configuration `config/environments/*.r
|
|
708
720
|
require 'moneta'
|
709
721
|
|
710
722
|
# Only by adapter name
|
711
|
-
config.cache_store :moneta_store, :
|
723
|
+
config.cache_store :moneta_store, store: :Memory
|
712
724
|
|
713
725
|
# Use Moneta.new
|
714
|
-
config.cache_store :moneta_store, :
|
726
|
+
config.cache_store :moneta_store, store: Moneta.new(:Memory)
|
715
727
|
|
716
728
|
# Use the Moneta builder
|
717
|
-
config.cache_store :moneta_store, :
|
729
|
+
config.cache_store :moneta_store, store: Moneta.build do
|
718
730
|
use :Expires
|
719
731
|
adapter :Memory
|
720
732
|
end
|
@@ -729,19 +741,31 @@ Moneta cache store doesn't support matchers. If you need these features use a di
|
|
729
741
|
require 'moneta'
|
730
742
|
|
731
743
|
# Only by adapter name
|
732
|
-
config.cache_store :moneta_store, :
|
744
|
+
config.cache_store :moneta_store, store: :Memory
|
733
745
|
|
734
746
|
# Use Moneta.new
|
735
|
-
config.cache_store :moneta_store, :
|
747
|
+
config.cache_store :moneta_store, store: Moneta.new(:Memory)
|
736
748
|
|
737
749
|
# Use the Moneta builder
|
738
|
-
config.cache_store :moneta_store, :
|
750
|
+
config.cache_store :moneta_store, store: Moneta.build do
|
739
751
|
use :Expires
|
740
752
|
adapter :Memory
|
741
753
|
end
|
742
754
|
~~~
|
743
755
|
|
744
|
-
|
756
|
+
### Padrino
|
757
|
+
|
758
|
+
[Padrino](http://padrinorb.com/) adopted Moneta to replace their cache stores in padrino-cache. You use it like this
|
759
|
+
|
760
|
+
~~~ ruby
|
761
|
+
# Global Padrino caching
|
762
|
+
# Don't forget the expires: [true, Integer] if you want expiration support!
|
763
|
+
Padrino.cache = Moneta.new(:Memory, expires: true)
|
764
|
+
|
765
|
+
# Application caching
|
766
|
+
# Don't forget the expires: [true, Integer] if you want expiration support!
|
767
|
+
set :cache, Moneta.new(:Memory, expires: true)
|
768
|
+
~~~
|
745
769
|
|
746
770
|
## Advanced
|
747
771
|
|
@@ -755,14 +779,14 @@ they will share the same data which will also be persistet in the database `shar
|
|
755
779
|
require 'moneta'
|
756
780
|
|
757
781
|
store = Moneta.build do
|
758
|
-
use :Transformer, :
|
782
|
+
use :Transformer, key: :marshal, value: :marshal
|
759
783
|
use :Shared do
|
760
784
|
use :Cache do
|
761
785
|
cache do
|
762
786
|
adapter :LRUHash
|
763
787
|
end
|
764
788
|
backend do
|
765
|
-
adapter :GDBM, :
|
789
|
+
adapter :GDBM, file: 'shared.db'
|
766
790
|
end
|
767
791
|
end
|
768
792
|
end
|
@@ -794,7 +818,7 @@ Person.adapter :memory, Moneta.new(:Redis)
|
|
794
818
|
|
795
819
|
## Testing and Benchmarks
|
796
820
|
|
797
|
-
Testing is done using [Travis-CI](http://travis-ci.org/minad/moneta). Currently we support Ruby
|
821
|
+
Testing is done using [Travis-CI](http://travis-ci.org/minad/moneta). Currently we support Ruby >= 1.9.3.
|
798
822
|
|
799
823
|
Benchmarks for each store are done on [Travis-CI](http://travis-ci.org/minad/moneta) for each build. Take a look there
|
800
824
|
to compare the speed of the different key value stores for different key/value sizes and size distributions.
|
@@ -834,7 +858,6 @@ Don't forget to edit the README.md and the CHANGES.
|
|
834
858
|
|
835
859
|
* [Horcrux](https://github.com/technoweenie/horcrux): Used at github, supports batch operations but only Memcached backend
|
836
860
|
* [ActiveSupport::Cache::Store](http://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html): The Rails cache store abstraction
|
837
|
-
* [Padrino::Cache::Store](http://www.padrinorb.com/api/Padrino/Cache/Store.html): The Padrino cache store abstraction. Padrino is currently considering switching to Moneta, see https://github.com/padrino/padrino-framework/pull/1018
|
838
861
|
* [ToyStore](https://github.com/jnunemaker/toystore): ORM mapper for key/value stores
|
839
862
|
* [ToyStore Adapter](https://github.com/jnunemaker/adapter): Adapter to key/value stores used by ToyStore, Moneta can be used directly with the ToyStore Memory adapter
|
840
863
|
* [Cache](https://github.com/seamusabshere/cache): Rubygem cache wraps Memcached and Redis
|