moneta 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.rspec +4 -0
- data/.travis.yml +83 -32
- data/.yardopts +6 -1
- data/CHANGES +30 -0
- data/CONTRIBUTORS +4 -0
- data/Gemfile +28 -36
- data/LICENSE +1 -1
- data/README.md +136 -67
- data/SPEC.md +70 -0
- data/feature_matrix.yaml +235 -0
- data/lib/active_support/cache/moneta_store.rb +102 -6
- data/lib/moneta.rb +9 -2
- data/lib/moneta/adapters/activerecord.rb +258 -98
- data/lib/moneta/adapters/activesupportcache.rb +133 -0
- data/lib/moneta/adapters/cassandra.rb +290 -44
- data/lib/moneta/adapters/client.rb +11 -2
- data/lib/moneta/adapters/couch.rb +179 -25
- data/lib/moneta/adapters/datamapper.rb +1 -0
- data/lib/moneta/adapters/daybreak.rb +21 -4
- data/lib/moneta/adapters/dbm.rb +7 -7
- data/lib/moneta/adapters/file.rb +11 -1
- data/lib/moneta/adapters/gdbm.rb +7 -7
- data/lib/moneta/adapters/kyotocabinet.rb +66 -1
- data/lib/moneta/adapters/leveldb.rb +27 -1
- data/lib/moneta/adapters/lmdb.rb +29 -1
- data/lib/moneta/adapters/lruhash.rb +30 -0
- data/lib/moneta/adapters/memcached/dalli.rb +50 -5
- data/lib/moneta/adapters/memcached/native.rb +11 -4
- data/lib/moneta/adapters/memory.rb +2 -0
- data/lib/moneta/adapters/mongo/base.rb +32 -7
- data/lib/moneta/adapters/mongo/moped.rb +59 -2
- data/lib/moneta/adapters/mongo/official.rb +40 -0
- data/lib/moneta/adapters/pstore.rb +56 -8
- data/lib/moneta/adapters/redis.rb +79 -19
- data/lib/moneta/adapters/sdbm.rb +7 -7
- data/lib/moneta/adapters/sequel.rb +440 -39
- data/lib/moneta/adapters/sqlite.rb +74 -10
- data/lib/moneta/adapters/tdb.rb +16 -1
- data/lib/moneta/adapters/tokyocabinet.rb +7 -1
- data/lib/moneta/adapters/tokyotyrant.rb +22 -0
- data/lib/moneta/cache.rb +11 -1
- data/lib/moneta/expires.rb +110 -8
- data/lib/moneta/lock.rb +21 -2
- data/lib/moneta/mixins.rb +279 -3
- data/lib/moneta/pool.rb +15 -6
- data/lib/moneta/proxy.rb +46 -2
- data/lib/moneta/server.rb +5 -1
- data/lib/moneta/shared.rb +27 -11
- data/lib/moneta/stack.rb +1 -1
- data/lib/moneta/synchronize.rb +2 -8
- data/lib/moneta/transformer.rb +152 -2
- data/lib/moneta/transformer/config.rb +2 -0
- data/lib/moneta/transformer/helper.rb +2 -2
- data/lib/moneta/version.rb +1 -1
- data/lib/moneta/weak_each_key.rb +74 -0
- data/lib/moneta/wrapper.rb +25 -0
- data/moneta.gemspec +2 -2
- data/script/benchmarks +174 -62
- data/script/parallel-tests +58 -83
- data/script/start-hbase +46 -0
- data/script/start-services +9 -2
- data/script/update-feature-matrix +148 -0
- data/spec/active_support/cache_moneta_store_spec.rb +132 -109
- data/spec/features/concurrent_create.rb +21 -0
- data/spec/features/concurrent_increment.rb +32 -0
- data/spec/features/create.rb +25 -0
- data/spec/features/create_expires.rb +19 -0
- data/spec/features/default_expires.rb +15 -0
- data/spec/features/each_key.rb +119 -0
- data/spec/features/expires.rb +291 -0
- data/spec/features/features.rb +16 -0
- data/spec/features/increment.rb +98 -0
- data/spec/features/marshallable_key.rb +43 -0
- data/spec/features/marshallable_value.rb +7 -0
- data/spec/features/multiprocess.rb +8 -0
- data/spec/features/not_create.rb +7 -0
- data/spec/features/not_each_key.rb +7 -0
- data/spec/features/not_increment.rb +13 -0
- data/spec/features/not_persist.rb +9 -0
- data/spec/features/null.rb +66 -0
- data/spec/features/persist.rb +14 -0
- data/spec/features/returndifferent.rb +9 -0
- data/spec/features/returnsame.rb +9 -0
- data/spec/features/store.rb +261 -0
- data/spec/features/store_large.rb +13 -0
- data/spec/features/transform_value.rb +44 -0
- data/spec/features/transform_value_expires.rb +41 -0
- data/spec/helper.rb +391 -74
- data/spec/moneta/adapters/activerecord/adapter_activerecord_existing_connection_spec.rb +59 -0
- data/spec/moneta/adapters/activerecord/adapter_activerecord_spec.rb +118 -0
- data/spec/moneta/adapters/activerecord/standard_activerecord_spec.rb +18 -0
- data/spec/moneta/adapters/activerecord/standard_activerecord_with_expires_spec.rb +24 -0
- data/spec/moneta/adapters/activesupportcache/adapter_activesupportcache_spec.rb +51 -0
- data/spec/moneta/adapters/activesupportcache/adapter_activesupportcache_with_default_expires_spec.rb +51 -0
- data/spec/moneta/adapters/cassandra/adapter_cassandra_spec.rb +17 -0
- data/spec/moneta/adapters/cassandra/adapter_cassandra_with_default_expires_spec.rb +18 -0
- data/spec/moneta/adapters/cassandra/helper.rb +18 -0
- data/spec/moneta/adapters/cassandra/standard_cassandra_spec.rb +18 -0
- data/spec/moneta/adapters/client/adapter_client_spec.rb +11 -0
- data/spec/moneta/adapters/client/standard_client_tcp_spec.rb +23 -0
- data/spec/moneta/adapters/client/standard_client_unix_spec.rb +12 -0
- data/spec/moneta/adapters/cookie/adapter_cookie_spec.rb +7 -0
- data/spec/moneta/adapters/couch/adapter_couch_spec.rb +7 -0
- data/spec/moneta/adapters/couch/standard_couch_spec.rb +9 -0
- data/spec/moneta/adapters/couch/standard_couch_with_expires_spec.rb +13 -0
- data/spec/moneta/adapters/datamapper/adapter_datamapper_spec.rb +43 -0
- data/spec/moneta/adapters/datamapper/standard_datamapper_spec.rb +21 -0
- data/spec/moneta/adapters/datamapper/standard_datamapper_with_expires_spec.rb +26 -0
- data/spec/moneta/adapters/datamapper/standard_datamapper_with_repository_spec.rb +22 -0
- data/spec/moneta/adapters/daybreak/adapter_daybreak_spec.rb +7 -0
- data/spec/moneta/adapters/daybreak/standard_daybreak_spec.rb +7 -0
- data/spec/moneta/adapters/daybreak/standard_daybreak_with_expires_spec.rb +11 -0
- data/spec/moneta/adapters/dbm/adapter_dbm_spec.rb +7 -0
- data/spec/moneta/adapters/dbm/standard_dbm_spec.rb +7 -0
- data/spec/moneta/adapters/dbm/standard_dbm_with_expires_spec.rb +12 -0
- data/spec/moneta/adapters/file/adapter_file_spec.rb +7 -0
- data/spec/moneta/adapters/file/standard_file_spec.rb +7 -0
- data/spec/moneta/adapters/file/standard_file_with_expires_spec.rb +11 -0
- data/spec/moneta/adapters/fog/adapter_fog_spec.rb +16 -0
- data/spec/moneta/adapters/fog/standard_fog_spec.rb +15 -0
- data/spec/moneta/adapters/fog/standard_fog_with_expires_spec.rb +20 -0
- data/spec/moneta/adapters/gdbm/adapter_gdbm_spec.rb +7 -0
- data/spec/moneta/adapters/gdbm/standard_gdbm_spec.rb +7 -0
- data/spec/moneta/adapters/gdbm/standard_gdbm_with_expires_spec.rb +11 -0
- data/spec/moneta/adapters/hashfile/standard_hashfile_spec.rb +7 -0
- data/spec/moneta/adapters/hashfile/standard_hashfile_with_expires_spec.rb +12 -0
- data/spec/moneta/adapters/hbase/adapter_hbase_spec.rb +7 -0
- data/spec/moneta/adapters/hbase/standard_hbase_spec.rb +4 -0
- data/spec/moneta/adapters/hbase/standard_hbase_with_expires_spec.rb +8 -0
- data/spec/moneta/adapters/kyotocabinet/adapter_kyotocabinet_spec.rb +7 -0
- data/spec/moneta/adapters/kyotocabinet/standard_kyotocabinet_spec.rb +7 -0
- data/spec/moneta/adapters/kyotocabinet/standard_kyotocabinet_with_expires_spec.rb +14 -0
- data/spec/moneta/adapters/leveldb/adapter_leveldb_spec.rb +7 -0
- data/spec/moneta/adapters/leveldb/standard_leveldb_spec.rb +7 -0
- data/spec/moneta/adapters/leveldb/standard_leveldb_with_expires_spec.rb +11 -0
- data/spec/moneta/adapters/lmdb/adapter_lmdb_spec.rb +7 -0
- data/spec/moneta/adapters/lmdb/adapter_lmdb_with_db_spec.rb +7 -0
- data/spec/moneta/adapters/lmdb/standard_lmdb_spec.rb +7 -0
- data/spec/moneta/adapters/lmdb/standard_lmdb_with_expires_spec.rb +11 -0
- data/spec/moneta/adapters/localmemcache/adapter_localmemcache_spec.rb +7 -0
- data/spec/moneta/adapters/localmemcache/standard_localmemcache_spec.rb +7 -0
- data/spec/moneta/adapters/localmemcache/standard_localmemcache_with_expires_spec.rb +11 -0
- data/spec/moneta/{adapter_lruhash_spec.rb → adapters/lruhash/adapter_lruhash_spec.rb} +3 -25
- data/spec/moneta/adapters/lruhash/standard_lruhash_spec.rb +4 -0
- data/spec/moneta/adapters/lruhash/standard_lruhash_with_expires_spec.rb +8 -0
- data/spec/moneta/adapters/memcached/adapter_memcached_spec.rb +13 -0
- data/spec/moneta/adapters/memcached/dalli/adapter_memcached_dalli_spec.rb +15 -0
- data/spec/moneta/adapters/memcached/dalli/adapter_memcached_dalli_with_default_expires_spec.rb +15 -0
- data/spec/moneta/adapters/memcached/dalli/standard_memcached_dalli_spec.rb +11 -0
- data/spec/moneta/adapters/memcached/helper.rb +20 -0
- data/spec/moneta/adapters/memcached/native/adapter_memcached_native_spec.rb +15 -0
- data/spec/moneta/adapters/memcached/native/adapter_memcached_native_with_default_expires_spec.rb +15 -0
- data/spec/moneta/adapters/memcached/native/standard_memcached_native_spec.rb +11 -0
- data/spec/moneta/adapters/memcached/standard_memcached_spec.rb +17 -0
- data/spec/moneta/adapters/memory/adapter_memory_spec.rb +7 -0
- data/spec/moneta/adapters/memory/standard_memory_spec.rb +4 -0
- data/spec/moneta/adapters/memory/standard_memory_with_compress_spec.rb +9 -0
- data/spec/moneta/adapters/memory/standard_memory_with_expires_spec.rb +8 -0
- data/spec/moneta/adapters/memory/standard_memory_with_json_key_serializer_spec.rb +4 -0
- data/spec/moneta/adapters/memory/standard_memory_with_json_serializer_spec.rb +9 -0
- data/spec/moneta/adapters/memory/standard_memory_with_json_value_serializer_spec.rb +9 -0
- data/spec/moneta/adapters/memory/standard_memory_with_prefix_spec.rb +4 -0
- data/spec/moneta/adapters/memory/standard_memory_with_snappy_compress_spec.rb +9 -0
- data/spec/moneta/adapters/mongo/adapter_mongo_moped_spec.rb +25 -0
- data/spec/moneta/adapters/mongo/adapter_mongo_moped_with_default_expires_spec.rb +12 -0
- data/spec/moneta/adapters/mongo/adapter_mongo_official_spec.rb +25 -0
- data/spec/moneta/adapters/mongo/adapter_mongo_official_with_default_expires_spec.rb +12 -0
- data/spec/moneta/adapters/mongo/adapter_mongo_spec.rb +11 -0
- data/spec/moneta/adapters/mongo/adapter_mongo_with_default_expires_spec.rb +12 -0
- data/spec/moneta/adapters/mongo/standard_mongo_moped_spec.rb +7 -0
- data/spec/moneta/adapters/mongo/standard_mongo_official_spec.rb +7 -0
- data/spec/moneta/adapters/mongo/standard_mongo_spec.rb +7 -0
- data/spec/moneta/adapters/null/null_adapter_spec.rb +7 -0
- data/spec/moneta/adapters/null/standard_null_spec.rb +4 -0
- data/spec/moneta/adapters/pstore/adapter_pstore_spec.rb +7 -0
- data/spec/moneta/adapters/pstore/standard_pstore_spec.rb +9 -0
- data/spec/moneta/adapters/pstore/standard_pstore_with_expires_spec.rb +13 -0
- data/spec/moneta/adapters/redis/adapter_redis_spec.rb +10 -0
- data/spec/moneta/adapters/redis/adapter_redis_with_default_expires_spec.rb +10 -0
- data/spec/moneta/adapters/redis/standard_redis_spec.rb +7 -0
- data/spec/moneta/adapters/restclient/adapter_restclient_spec.rb +11 -0
- data/spec/moneta/adapters/restclient/standard_restclient_spec.rb +10 -0
- data/spec/moneta/adapters/riak/adapter_riak_spec.rb +14 -0
- data/spec/moneta/adapters/riak/standard_riak_spec.rb +10 -0
- data/spec/moneta/adapters/riak/standard_riak_with_expires_spec.rb +10 -0
- data/spec/moneta/adapters/sdbm/adapter_sdbm_spec.rb +7 -0
- data/spec/moneta/adapters/sdbm/standard_sdbm_spec.rb +7 -0
- data/spec/moneta/adapters/sdbm/standard_sdbm_with_expires_spec.rb +11 -0
- data/spec/moneta/adapters/sequel/adapter_sequel_spec.rb +181 -0
- data/spec/moneta/adapters/sequel/standard_sequel_spec.rb +14 -0
- data/spec/moneta/adapters/sequel/standard_sequel_with_expires_spec.rb +19 -0
- data/spec/moneta/adapters/sqlite/adapter_sqlite_spec.rb +7 -0
- data/spec/moneta/adapters/sqlite/standard_sqlite_spec.rb +7 -0
- data/spec/moneta/adapters/sqlite/standard_sqlite_with_expires_spec.rb +15 -0
- data/spec/moneta/adapters/tdb/adapter_tdb_spec.rb +7 -0
- data/spec/moneta/adapters/tdb/standard_tdb_spec.rb +7 -0
- data/spec/moneta/adapters/tdb/standard_tdb_with_expires_spec.rb +11 -0
- data/spec/moneta/adapters/tokyocabinet/adapter_tokyocabinet_bdb_spec.rb +7 -0
- data/spec/moneta/adapters/tokyocabinet/adapter_tokyocabinet_hdb_spec.rb +7 -0
- data/spec/moneta/adapters/tokyocabinet/standard_tokyocabinet_spec.rb +7 -0
- data/spec/moneta/adapters/tokyocabinet/standard_tokyocabinet_with_expires_spec.rb +11 -0
- data/spec/moneta/adapters/tokyotyrant/adapter_tokyotyrant_spec.rb +7 -0
- data/spec/moneta/adapters/tokyotyrant/standard_tokyotyrant_spec.rb +4 -0
- data/spec/moneta/adapters/tokyotyrant/standard_tokyotyrant_with_expires_spec.rb +8 -0
- data/spec/moneta/adapters/yaml/adapter_yaml_spec.rb +7 -0
- data/spec/moneta/adapters/yaml/standard_yaml_spec.rb +9 -0
- data/spec/moneta/adapters/yaml/standard_yaml_with_expires_spec.rb +13 -0
- data/spec/moneta/builder_spec.rb +0 -1
- data/spec/moneta/mutex_spec.rb +6 -23
- data/spec/moneta/proxies/cache/cache_file_memory_spec.rb +24 -0
- data/spec/moneta/proxies/cache/cache_memory_null_spec.rb +12 -0
- data/spec/moneta/proxies/expires/expires_file_spec.rb +28 -0
- data/spec/moneta/proxies/expires/expires_memory_spec.rb +15 -0
- data/spec/moneta/proxies/expires/expires_memory_with_default_expires_spec.rb +16 -0
- data/spec/moneta/proxies/lock/lock_spec.rb +10 -0
- data/spec/moneta/{optionmerger_spec.rb → proxies/optionmerger/optionmerger_spec.rb} +2 -18
- data/spec/moneta/proxies/pool/pool_spec.rb +12 -0
- data/spec/moneta/proxies/proxy/proxy_expires_memory_spec.rb +16 -0
- data/spec/moneta/proxies/proxy/proxy_redis_spec.rb +13 -0
- data/spec/moneta/proxies/shared/shared_tcp_spec.rb +49 -0
- data/spec/moneta/proxies/shared/shared_unix_spec.rb +48 -0
- data/spec/moneta/proxies/transformer/transformer_bencode_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_bert_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_bson_spec.rb +23 -0
- data/spec/moneta/proxies/transformer/transformer_bzip2_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_json_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_key_inspect_spec.rb +17 -0
- data/spec/moneta/proxies/transformer/transformer_key_marshal_spec.rb +17 -0
- data/spec/moneta/proxies/transformer/transformer_key_to_s_spec.rb +17 -0
- data/spec/moneta/proxies/transformer/transformer_key_yaml_spec.rb +17 -0
- data/spec/moneta/proxies/transformer/transformer_lz4_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_lzma_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_lzo_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_base64_spec.rb +20 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_city128_spec.rb +15 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_city32_spec.rb +15 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_city64_spec.rb +15 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_escape_spec.rb +15 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_hex_spec.rb +20 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_hmac_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_md5_spec.rb +15 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_md5_spread_spec.rb +15 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_prefix_spec.rb +15 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_qp_spec.rb +20 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_rmd160_spec.rb +15 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_sha1_spec.rb +15 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_sha256_spec.rb +15 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_sha384_spec.rb +15 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_sha512_spec.rb +15 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_truncate_spec.rb +15 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_urlsafe_base64_spec.rb +20 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_uuencode_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_msgpack_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_ox_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_php_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_quicklz_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_snappy_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_tnet_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_value_marshal_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_value_yaml_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_yaml_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_zlib_spec.rb +19 -0
- data/spec/moneta/proxies/weak_create/weak_create_spec.rb +21 -0
- data/spec/moneta/proxies/weak_each_key/weak_each_key_spec.rb +24 -0
- data/spec/moneta/proxies/weak_increment/weak_increment_spec.rb +21 -0
- data/spec/moneta/semaphore_spec.rb +6 -23
- data/spec/moneta/stack_file_memory_spec.rb +5 -29
- data/spec/moneta/stack_memory_file_spec.rb +5 -31
- data/spec/quality_spec.rb +1 -1
- data/{spec → test}/action_dispatch/fixtures/session_autoload_test/foo.rb +0 -0
- data/{spec/action_dispatch/session_moneta_store_spec.rb → test/action_dispatch/session_moneta_store_test.rb} +13 -5
- metadata +415 -355
- data/script/generate-specs +0 -2696
- data/spec/moneta/adapter_activerecord_exisiting_connection_spec.rb +0 -36
- data/spec/moneta/adapter_activerecord_spec.rb +0 -65
- data/spec/moneta/adapter_cassandra_spec.rb +0 -33
- data/spec/moneta/adapter_cassandra_with_default_expires_spec.rb +0 -34
- data/spec/moneta/adapter_client_spec.rb +0 -35
- data/spec/moneta/adapter_cookie_spec.rb +0 -30
- data/spec/moneta/adapter_couch_spec.rb +0 -36
- data/spec/moneta/adapter_datamapper_spec.rb +0 -64
- data/spec/moneta/adapter_daybreak_spec.rb +0 -31
- data/spec/moneta/adapter_dbm_spec.rb +0 -31
- data/spec/moneta/adapter_file_spec.rb +0 -34
- data/spec/moneta/adapter_fog_spec.rb +0 -37
- data/spec/moneta/adapter_gdbm_spec.rb +0 -31
- data/spec/moneta/adapter_hbase_spec.rb +0 -33
- data/spec/moneta/adapter_kyotocabinet_spec.rb +0 -31
- data/spec/moneta/adapter_leveldb_spec.rb +0 -31
- data/spec/moneta/adapter_lmdb_spec.rb +0 -32
- data/spec/moneta/adapter_lmdb_with_db_spec.rb +0 -32
- data/spec/moneta/adapter_localmemcache_spec.rb +0 -32
- data/spec/moneta/adapter_memcached_dalli_spec.rb +0 -36
- data/spec/moneta/adapter_memcached_dalli_with_default_expires_spec.rb +0 -37
- data/spec/moneta/adapter_memcached_native_spec.rb +0 -36
- data/spec/moneta/adapter_memcached_native_with_default_expires_spec.rb +0 -37
- data/spec/moneta/adapter_memcached_spec.rb +0 -36
- data/spec/moneta/adapter_memcached_with_default_expires_spec.rb +0 -37
- data/spec/moneta/adapter_memory_spec.rb +0 -184
- data/spec/moneta/adapter_mongo_moped_spec.rb +0 -64
- data/spec/moneta/adapter_mongo_moped_with_default_expires_spec.rb +0 -53
- data/spec/moneta/adapter_mongo_official_spec.rb +0 -64
- data/spec/moneta/adapter_mongo_official_with_default_expires_spec.rb +0 -53
- data/spec/moneta/adapter_mongo_spec.rb +0 -51
- data/spec/moneta/adapter_mongo_with_default_expires_spec.rb +0 -53
- data/spec/moneta/adapter_pstore_spec.rb +0 -250
- data/spec/moneta/adapter_redis_spec.rb +0 -36
- data/spec/moneta/adapter_redis_with_default_expires_spec.rb +0 -37
- data/spec/moneta/adapter_restclient_spec.rb +0 -33
- data/spec/moneta/adapter_riak_spec.rb +0 -36
- data/spec/moneta/adapter_sdbm_spec.rb +0 -30
- data/spec/moneta/adapter_sequel_spec.rb +0 -34
- data/spec/moneta/adapter_sqlite_spec.rb +0 -32
- data/spec/moneta/adapter_tdb_spec.rb +0 -31
- data/spec/moneta/adapter_tokyocabinet_bdb_spec.rb +0 -31
- data/spec/moneta/adapter_tokyocabinet_hdb_spec.rb +0 -31
- data/spec/moneta/adapter_tokyotyrant_spec.rb +0 -34
- data/spec/moneta/adapter_yaml_spec.rb +0 -57
- data/spec/moneta/cache_file_memory_spec.rb +0 -50
- data/spec/moneta/cache_memory_null_spec.rb +0 -35
- data/spec/moneta/expires_file_spec.rb +0 -78
- data/spec/moneta/expires_memory_spec.rb +0 -189
- data/spec/moneta/expires_memory_with_default_expires_spec.rb +0 -190
- data/spec/moneta/lock_spec.rb +0 -187
- data/spec/moneta/null_adapter_spec.rb +0 -86
- data/spec/moneta/pool_spec.rb +0 -38
- data/spec/moneta/proxy_expires_memory_spec.rb +0 -191
- data/spec/moneta/proxy_redis_spec.rb +0 -40
- data/spec/moneta/shared_tcp_spec.rb +0 -46
- data/spec/moneta/shared_unix_spec.rb +0 -46
- data/spec/moneta/standard_activerecord_spec.rb +0 -253
- data/spec/moneta/standard_activerecord_with_expires_spec.rb +0 -255
- data/spec/moneta/standard_cassandra_spec.rb +0 -252
- data/spec/moneta/standard_client_tcp_spec.rb +0 -269
- data/spec/moneta/standard_client_unix_spec.rb +0 -254
- data/spec/moneta/standard_couch_spec.rb +0 -252
- data/spec/moneta/standard_couch_with_expires_spec.rb +0 -254
- data/spec/moneta/standard_datamapper_spec.rb +0 -254
- data/spec/moneta/standard_datamapper_with_expires_spec.rb +0 -256
- data/spec/moneta/standard_datamapper_with_repository_spec.rb +0 -254
- data/spec/moneta/standard_daybreak_spec.rb +0 -250
- data/spec/moneta/standard_daybreak_with_expires_spec.rb +0 -252
- data/spec/moneta/standard_dbm_spec.rb +0 -250
- data/spec/moneta/standard_dbm_with_expires_spec.rb +0 -252
- data/spec/moneta/standard_file_spec.rb +0 -253
- data/spec/moneta/standard_file_with_expires_spec.rb +0 -255
- data/spec/moneta/standard_fog_spec.rb +0 -256
- data/spec/moneta/standard_fog_with_expires_spec.rb +0 -258
- data/spec/moneta/standard_gdbm_spec.rb +0 -250
- data/spec/moneta/standard_gdbm_with_expires_spec.rb +0 -252
- data/spec/moneta/standard_hashfile_spec.rb +0 -253
- data/spec/moneta/standard_hashfile_with_expires_spec.rb +0 -255
- data/spec/moneta/standard_hbase_spec.rb +0 -252
- data/spec/moneta/standard_hbase_with_expires_spec.rb +0 -255
- data/spec/moneta/standard_kyotocabinet_spec.rb +0 -250
- data/spec/moneta/standard_kyotocabinet_with_expires_spec.rb +0 -252
- data/spec/moneta/standard_leveldb_spec.rb +0 -250
- data/spec/moneta/standard_leveldb_with_expires_spec.rb +0 -252
- data/spec/moneta/standard_lmdb_spec.rb +0 -251
- data/spec/moneta/standard_lmdb_with_expires_spec.rb +0 -253
- data/spec/moneta/standard_localmemcache_spec.rb +0 -251
- data/spec/moneta/standard_localmemcache_with_expires_spec.rb +0 -252
- data/spec/moneta/standard_lruhash_spec.rb +0 -187
- data/spec/moneta/standard_lruhash_with_expires_spec.rb +0 -189
- data/spec/moneta/standard_memcached_dalli_spec.rb +0 -255
- data/spec/moneta/standard_memcached_native_spec.rb +0 -255
- data/spec/moneta/standard_memcached_spec.rb +0 -255
- data/spec/moneta/standard_memory_spec.rb +0 -187
- data/spec/moneta/standard_memory_with_compress_spec.rb +0 -187
- data/spec/moneta/standard_memory_with_expires_spec.rb +0 -189
- data/spec/moneta/standard_memory_with_json_key_serializer_spec.rb +0 -86
- data/spec/moneta/standard_memory_with_json_serializer_spec.rb +0 -49
- data/spec/moneta/standard_memory_with_json_value_serializer_spec.rb +0 -90
- data/spec/moneta/standard_memory_with_prefix_spec.rb +0 -187
- data/spec/moneta/standard_memory_with_snappy_compress_spec.rb +0 -187
- data/spec/moneta/standard_mongo_moped_spec.rb +0 -255
- data/spec/moneta/standard_mongo_official_spec.rb +0 -255
- data/spec/moneta/standard_mongo_spec.rb +0 -255
- data/spec/moneta/standard_null_spec.rb +0 -120
- data/spec/moneta/standard_pstore_spec.rb +0 -253
- data/spec/moneta/standard_pstore_with_expires_spec.rb +0 -255
- data/spec/moneta/standard_redis_spec.rb +0 -255
- data/spec/moneta/standard_restclient_spec.rb +0 -252
- data/spec/moneta/standard_riak_spec.rb +0 -255
- data/spec/moneta/standard_riak_with_expires_spec.rb +0 -256
- data/spec/moneta/standard_sdbm_spec.rb +0 -249
- data/spec/moneta/standard_sdbm_with_expires_spec.rb +0 -251
- data/spec/moneta/standard_sequel_spec.rb +0 -253
- data/spec/moneta/standard_sequel_with_expires_spec.rb +0 -255
- data/spec/moneta/standard_sqlite_spec.rb +0 -251
- data/spec/moneta/standard_sqlite_with_expires_spec.rb +0 -253
- data/spec/moneta/standard_tdb_spec.rb +0 -250
- data/spec/moneta/standard_tdb_with_expires_spec.rb +0 -252
- data/spec/moneta/standard_tokyocabinet_spec.rb +0 -250
- data/spec/moneta/standard_tokyocabinet_with_expires_spec.rb +0 -252
- data/spec/moneta/standard_tokyotyrant_spec.rb +0 -253
- data/spec/moneta/standard_tokyotyrant_with_expires_spec.rb +0 -255
- data/spec/moneta/standard_yaml_spec.rb +0 -250
- data/spec/moneta/standard_yaml_with_expires_spec.rb +0 -252
- data/spec/moneta/transformer_bencode_spec.rb +0 -55
- data/spec/moneta/transformer_bert_spec.rb +0 -55
- data/spec/moneta/transformer_bson_spec.rb +0 -60
- data/spec/moneta/transformer_bzip2_spec.rb +0 -55
- data/spec/moneta/transformer_json_spec.rb +0 -55
- data/spec/moneta/transformer_key_inspect_spec.rb +0 -91
- data/spec/moneta/transformer_key_marshal_spec.rb +0 -191
- data/spec/moneta/transformer_key_to_s_spec.rb +0 -91
- data/spec/moneta/transformer_key_yaml_spec.rb +0 -191
- data/spec/moneta/transformer_lz4_spec.rb +0 -55
- data/spec/moneta/transformer_lzma_spec.rb +0 -55
- data/spec/moneta/transformer_lzo_spec.rb +0 -55
- data/spec/moneta/transformer_marshal_base64_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_city128_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_city32_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_city64_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_escape_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_hex_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_hmac_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_md5_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_md5_spread_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_prefix_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_qp_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_rmd160_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_sha1_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_sha256_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_sha384_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_sha512_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_spec.rb +0 -191
- data/spec/moneta/transformer_marshal_truncate_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_uuencode_spec.rb +0 -194
- data/spec/moneta/transformer_msgpack_spec.rb +0 -55
- data/spec/moneta/transformer_ox_spec.rb +0 -191
- data/spec/moneta/transformer_php_spec.rb +0 -55
- data/spec/moneta/transformer_quicklz_spec.rb +0 -55
- data/spec/moneta/transformer_snappy_spec.rb +0 -55
- data/spec/moneta/transformer_tnet_spec.rb +0 -55
- data/spec/moneta/transformer_value_marshal_spec.rb +0 -191
- data/spec/moneta/transformer_value_yaml_spec.rb +0 -191
- data/spec/moneta/transformer_yaml_spec.rb +0 -191
- data/spec/moneta/transformer_zlib_spec.rb +0 -55
- data/spec/moneta/weak_create_spec.rb +0 -41
- data/spec/moneta/weak_increment_spec.rb +0 -41
- data/spec/monetaspecs.rb +0 -51267
data/SPEC.md
CHANGED
@@ -67,6 +67,67 @@ Closes the store
|
|
67
67
|
|
68
68
|
Feature detection. Adapters MUST return <code>:create</code> and <code>:increment</code> if these methods are supported.
|
69
69
|
|
70
|
+
### `each_key => Enumerator` and `each_key(&block) => Object`
|
71
|
+
|
72
|
+
Enumerates over the keys in the store. This method is not supported by all
|
73
|
+
stores. When not supported, this method MUST raise a `NotImplementedError`,
|
74
|
+
regardless of whether a block is supplied. When supported, this method allows
|
75
|
+
traversal of all keys in the store. The method behaves differently depending on
|
76
|
+
whether a block is supplied. In either case, for each key, `k` in the
|
77
|
+
traversal, `key?(k)` MUST return `true`; and for each key, `k` for which
|
78
|
+
`key?(k)` returns `true`, `k` MUST be traversed by `each_key`. Keys MAY be
|
79
|
+
traversed in any order. Mutation of the store while traversing keys MAY be
|
80
|
+
allowed. Querying the store (calling `fetch`, `key?`, etc.) while traversing
|
81
|
+
MUST be allowed.
|
82
|
+
|
83
|
+
* If no block is supplied, `each_key` MUST return an `Enumerator` that can be
|
84
|
+
used to traverse each key (e.g. by calling `each`). Calling methods on the
|
85
|
+
`Enumerator` such as `each` with a block MUST return the store object.
|
86
|
+
|
87
|
+
* If a block is supplied, that block MUST be called once with each traversed key
|
88
|
+
as the only argument. When called in this way, `each_key` MUST return the
|
89
|
+
store object.
|
90
|
+
|
91
|
+
### `values_at(*keys[Array<Object>], **options[Hash]) => Array<Object>`
|
92
|
+
|
93
|
+
Returns an array containing the values associated with the given keys, in the
|
94
|
+
same order as the supplied keys. If a key is not present in the
|
95
|
+
key-value-store, `nil` MUST be returned in its place. For each key, and each
|
96
|
+
value, the same restrictions apply as apply to individual keys passed to, and
|
97
|
+
values received from the store in the specification of `[]` (see above). The
|
98
|
+
adapter MAY perform this operation atomically.
|
99
|
+
|
100
|
+
### `fetch_values(*keys[Array<Object>], **options[Hash], &defaults) => Array<Object>`
|
101
|
+
|
102
|
+
Behaves identically to `values_at`, except that it MUST accept an optional
|
103
|
+
block. When supplied, the block will be called successively with each supplied
|
104
|
+
key that is not present in the store. The return value of the block call MUST
|
105
|
+
be used in place of `nil` in returned the array of values. As with `fetch`
|
106
|
+
(above), the adapter MUST NOT store the return value of the block call in the
|
107
|
+
key-value-store. The adapter MAY perform this operation atomically.
|
108
|
+
|
109
|
+
### `slice(*keys[Array<Object>], **options[Hash]) => <Array(Object, Object)>`
|
110
|
+
|
111
|
+
Returns a collection of key-value pairs corresponding to those supplied keys
|
112
|
+
which are present in the key-value store, and their associated values. A key
|
113
|
+
MUST be present in the return value if and only if it was supplied in the `keys`
|
114
|
+
parameter and it is present in the key-value store. For each key, and each
|
115
|
+
value, the same restrictions apply as apply to individual keys passed to, and
|
116
|
+
values received from the store in the specification of `[]` (see above). The
|
117
|
+
adapter MAY perform this operation atomically.
|
118
|
+
|
119
|
+
### `merge!(pairs[<Array(Object, Object)>], options[Hash] => {}, &block) => self`
|
120
|
+
|
121
|
+
Stores the pairs in the key-value-store, and returns the store object. This
|
122
|
+
method MUST behave identically to successively calling `[]=` with each key-value
|
123
|
+
pair and the options hash; except that the adapter MAY perform this operation
|
124
|
+
atomically, and the method MUST accept an optional block, which MUST be called
|
125
|
+
for each key that is to be overwritten. When the block is provided, it MUST be
|
126
|
+
called before overwriting any existing values with the key, old value and
|
127
|
+
supplied value, and the return value of the block MUST be used in place of the
|
128
|
+
supplied value. `merge!` MUST also be aliased as `update`.
|
129
|
+
|
130
|
+
|
70
131
|
## Additional Options Hashes
|
71
132
|
|
72
133
|
The following methods may all take an additional Hash as a final argument. This allows the client to send additional options which can be specified by the adapter (and which may be specified by extensions to this specification). The methods MUST NOT modify the supplied option hash.
|
@@ -78,6 +139,15 @@ The following methods may all take an additional Hash as a final argument. This
|
|
78
139
|
* key?
|
79
140
|
* increment
|
80
141
|
* clear
|
142
|
+
* merge!
|
143
|
+
|
144
|
+
Additionally, the following methods accept options as keyword arguments, after
|
145
|
+
non-keyword arguments. These keyword arguments are treated as a hash,
|
146
|
+
equivalent to supplying a hash to the above methods.
|
147
|
+
|
148
|
+
* values_at
|
149
|
+
* fetch_values
|
150
|
+
* slice
|
81
151
|
|
82
152
|
In the case of methods with optional arguments, the Hash MUST be provided as the final argument. Keys in this Hash MUST be Symbols.
|
83
153
|
|
data/feature_matrix.yaml
ADDED
@@ -0,0 +1,235 @@
|
|
1
|
+
---
|
2
|
+
group: Persistent stores
|
3
|
+
features: [ persist ]
|
4
|
+
notes:
|
5
|
+
poor multiprocess performance: >
|
6
|
+
Sqlite/YAML/PStore are multiprocess safe, but the performance suffers badly
|
7
|
+
since the whole database file must be locked for writing. Use a key/value
|
8
|
+
server if you want multiprocess concurrency!
|
9
|
+
backends:
|
10
|
+
- adapter: Mongo
|
11
|
+
platforms: [ MRI, JRuby ]
|
12
|
+
gems: mongo or moped
|
13
|
+
features: [ threadsafe, multiprocess, increment, create, expires, each_key, bulk_read, bulk_write ]
|
14
|
+
description: "[MongoDB](http://www.mongodb.org/) database"
|
15
|
+
- adapter: MongoOfficial
|
16
|
+
platforms: [ MRI, JRuby ]
|
17
|
+
gems: mongo
|
18
|
+
features: [ threadsafe, multiprocess, increment, create, expires, each_key, bulk_read, bulk_write ]
|
19
|
+
description: "[MongoDB](http://www.mongodb.org/) database"
|
20
|
+
- adapter: MongoMoped
|
21
|
+
platforms: [ MRI, JRuby ]
|
22
|
+
gems: moped
|
23
|
+
features: [ threadsafe, multiprocess, increment, create, expires, each_key, bulk_read, bulk_write ]
|
24
|
+
description: "[MongoDB](http://www.mongodb.org/) database"
|
25
|
+
- adapter: Redis
|
26
|
+
platforms: [ MRI, JRuby ]
|
27
|
+
gems: redis
|
28
|
+
features: [ threadsafe, multiprocess, increment, create, expires, each_key, bulk_read, bulk_write ]
|
29
|
+
description: "[Redis](http://redis.io/) database"
|
30
|
+
- adapter: ActiveRecord
|
31
|
+
platforms: [ MRI, JRuby ]
|
32
|
+
gems: activerecord
|
33
|
+
features: [ threadsafe, multiprocess, increment, create, each_key, bulk_read, bulk_write ]
|
34
|
+
description: "[ActiveRecord](https://rubygems.org/gems/activerecord) ORM"
|
35
|
+
- adapter: File
|
36
|
+
platforms: [ MRI, JRuby ]
|
37
|
+
features: [ threadsafe, multiprocess, increment, create, each_key ]
|
38
|
+
description: "File store"
|
39
|
+
- adapter: LMDB
|
40
|
+
platforms: [ MRI ]
|
41
|
+
gems: lmdb
|
42
|
+
features: [ threadsafe, multiprocess, increment, create, each_key, bulk_read, bulk_write ]
|
43
|
+
description: "[Symas Lightning Memory-Mapped Database (LMDB)](http://symas.com/mdb/)"
|
44
|
+
- adapter: Sequel
|
45
|
+
platforms: [ MRI, JRuby ]
|
46
|
+
gems: sequel
|
47
|
+
features: [ threadsafe, multiprocess, increment, create, each_key, bulk_read, bulk_write ]
|
48
|
+
description: "[Sequel](http://sequel.rubyforge.org/) ORM"
|
49
|
+
- adapter: TokyoTyrant
|
50
|
+
platforms: [ MRI, JRuby ]
|
51
|
+
gems: tokyotyrant or ruby-tokyotyrant
|
52
|
+
features: [ multiprocess, increment, create, bulk_read ]
|
53
|
+
description: "[TokyoTyrant](http://fallabs.com/tokyotyrant/) database"
|
54
|
+
- adapter: PStore
|
55
|
+
platforms: [ MRI ]
|
56
|
+
features: [ multiprocess, increment, create, each_key, bulk_read, bulk_write ]
|
57
|
+
description: "[PStore](http://ruby-doc.org/stdlib/libdoc/pstore/rdoc/PStore.html) store"
|
58
|
+
notes:
|
59
|
+
multiprocess: poor multiprocess performance
|
60
|
+
- adapter: YAML
|
61
|
+
platforms: [ MRI, JRuby ]
|
62
|
+
features: [ multiprocess, increment, create, each_key ]
|
63
|
+
description: "[YAML](http://www.ruby-doc.org/stdlib/libdoc/yaml/rdoc/YAML/Store.html) store"
|
64
|
+
notes:
|
65
|
+
multiprocess: poor multiprocess performance
|
66
|
+
- adapter: Sqlite
|
67
|
+
platforms: [ MRI ]
|
68
|
+
gems: sqlite3
|
69
|
+
features: [ multiprocess, increment, create, bulk_read, bulk_write, each_key ]
|
70
|
+
description: "[Sqlite3](http://sqlite.org/) database"
|
71
|
+
unknown: [ threadsafe ]
|
72
|
+
notes:
|
73
|
+
multiprocess: poor multiprocess performance
|
74
|
+
- adapter: Daybreak
|
75
|
+
platforms: [ MRI, JRuby ]
|
76
|
+
gems: daybreak
|
77
|
+
features: [ multiprocess, increment, create, each_key, bulk_write ]
|
78
|
+
description: "Incredibly fast pure-ruby key/value store [Daybreak](http://propublica.github.com/daybreak/)"
|
79
|
+
- adapter: DBM
|
80
|
+
platforms: [ MRI ]
|
81
|
+
features: [ increment, create, each_key, bulk_read, bulk_write ]
|
82
|
+
description: "[Berkeley DB using DBM interface or NDBM (Depends on Ruby environment)](http://www.ruby-doc.org/stdlib/libdoc/dbm/rdoc/DBM.html)"
|
83
|
+
- adapter: GDBM
|
84
|
+
platforms: [ MRI, JRuby ]
|
85
|
+
features: [ increment, create, each_key, bulk_read, bulk_write ]
|
86
|
+
description: "[GDBM](http://www.ruby-doc.org/stdlib/libdoc/gdbm/rdoc/GDBM.html) database"
|
87
|
+
- adapter: LevelDB
|
88
|
+
platforms: [ MRI ]
|
89
|
+
gems: leveldb
|
90
|
+
features: [ increment, create, each_key, bulk_read, bulk_write ]
|
91
|
+
description: "[LevelDB](http://code.google.com/p/leveldb/) database"
|
92
|
+
- adapter: SDBM
|
93
|
+
platforms: [ MRI ]
|
94
|
+
features: [ increment, create, each_key, bulk_read, bulk_write ]
|
95
|
+
description: "[SDBM](http://www.ruby-doc.org/stdlib/libdoc/sdbm/rdoc/SDBM.html) database"
|
96
|
+
- adapter: TDB
|
97
|
+
platforms: [ MRI ]
|
98
|
+
gems: tdb
|
99
|
+
features: [ increment, create, each_key ]
|
100
|
+
description: "[TDB](http://tdb.samba.org/) database"
|
101
|
+
- adapter: KyotoCabinet
|
102
|
+
platforms: [ MRI ]
|
103
|
+
gems: kyotocabinet-ruby or kyotocabinet-ruby-reanimated
|
104
|
+
features: [ increment, create, each_key, bulk_read, bulk_write ]
|
105
|
+
description: "[KyotoCabinet](http://fallabs.com/kyotocabinet/) database"
|
106
|
+
- adapter: TokyoCabinet
|
107
|
+
platforms: [ MRI ]
|
108
|
+
gems: tokyocabinet
|
109
|
+
features: [ increment, create, each_key ]
|
110
|
+
description: "[TokyoCabinet](http://fallabs.com/tokyocabinet/) database"
|
111
|
+
- adapter: DataMapper
|
112
|
+
platforms: [ MRI ]
|
113
|
+
gems: dm-core, dm-migrations
|
114
|
+
features: [ threadsafe, multiprocess, create ]
|
115
|
+
description: "[DataMapper](http://datamapper.org/) ORM"
|
116
|
+
- adapter: Couch
|
117
|
+
platforms: [ MRI, JRuby ]
|
118
|
+
gems: faraday, multi_json
|
119
|
+
features: [ multiprocess, create, each_key, bulk_read, bulk_write ]
|
120
|
+
description: "[CouchDB](http://couchdb.apache.org/) database"
|
121
|
+
- adapter: HBase
|
122
|
+
platforms: [ Unstable ]
|
123
|
+
gems: hbaserb
|
124
|
+
features: [ multiprocess, increment ]
|
125
|
+
unknown: [threadsafe]
|
126
|
+
description: "[HBase](http://hbase.apache.org/) database"
|
127
|
+
- adapter: Cassandra
|
128
|
+
platforms: [ MRI, JRuby ]
|
129
|
+
gems: cassandra
|
130
|
+
features: [ multiprocess, expires, each_key, bulk_read, bulk_write ]
|
131
|
+
unknown: [threadsafe]
|
132
|
+
description: "[Cassandra](http://cassandra.apache.org/) distributed database"
|
133
|
+
- adapter: LocalMemCache
|
134
|
+
platforms: [ MRI ]
|
135
|
+
gems: localmemcache
|
136
|
+
features: [ threadsafe, multiprocess ]
|
137
|
+
description: "[LocalMemCache](http://localmemcache.rubyforge.org/) database"
|
138
|
+
- adapter: Fog
|
139
|
+
platforms: [ MRI, JRuby ]
|
140
|
+
gems: fog
|
141
|
+
features: [multiprocess]
|
142
|
+
unknown: [threadsafe]
|
143
|
+
description: "[Fog](http://fog.io/) cloud store"
|
144
|
+
- adapter: Riak
|
145
|
+
platforms: [ Unstable ]
|
146
|
+
gems: riak-client
|
147
|
+
features: [multiprocess]
|
148
|
+
description: "[Riak](http://docs.basho.com/) database"
|
149
|
+
---
|
150
|
+
group: Non-persistent stores
|
151
|
+
notes:
|
152
|
+
memcached protocol: >
|
153
|
+
There are some servers which use the memcached protocol but which are persistent
|
154
|
+
(e.g. [MemcacheDB](http://memcachedb.org/),
|
155
|
+
[Kai](http://sourceforge.net/apps/mediawiki/kai),
|
156
|
+
[IronCache](http://dev.iron.io/cache/reference/memcache/),
|
157
|
+
[Roma](https://github.com/roma/roma/tree),
|
158
|
+
[Flare](http://labs.gree.jp/Top/OpenSource/Flare-en.html) and
|
159
|
+
[Kumofs](https://github.com/etolabo/kumofs))
|
160
|
+
memcached backend: >
|
161
|
+
This feature is only available if the dalli backend is selected
|
162
|
+
in-memory multiprocess caveat: >
|
163
|
+
Store is multi-process safe because it is an in-memory store, values are not
|
164
|
+
shared between multiple processes
|
165
|
+
backends:
|
166
|
+
- adapter: MemcachedDalli
|
167
|
+
platforms: [ MRI, JRuby ]
|
168
|
+
gems: dalli
|
169
|
+
features: [ threadsafe, multiprocess, increment, create, expires, bulk_read, bulk_write ]
|
170
|
+
description: "[Memcached](http://memcached.org/) database with Dalli library"
|
171
|
+
notes:
|
172
|
+
persist: memcached protocol
|
173
|
+
- adapter: Memcached
|
174
|
+
platforms: [ MRI ]
|
175
|
+
gems: dalli or memcached
|
176
|
+
features: [ multiprocess, increment, create, expires ]
|
177
|
+
unknown: [ threadsafe, bulk_read, bulk_write, JRuby ]
|
178
|
+
description: "[Memcached](http://memcached.org/) database"
|
179
|
+
notes:
|
180
|
+
persist: memcached protocol
|
181
|
+
JRuby: memcached backend
|
182
|
+
threadsafe: memcached backend
|
183
|
+
bulk_read: memcached backend
|
184
|
+
bulk_write: memcached backend
|
185
|
+
- adapter: MemcachedNative
|
186
|
+
platforms: [ MRI ]
|
187
|
+
gems: memcached
|
188
|
+
features: [ multiprocess, increment, create, expires ]
|
189
|
+
description: "Memcached database with native library"
|
190
|
+
notes:
|
191
|
+
persist: memcached protocol
|
192
|
+
- adapter: Cookie
|
193
|
+
platforms: [ MRI, JRuby ]
|
194
|
+
features: [ multiprocess, increment, create, expires, each_key ]
|
195
|
+
description: "Cookie in memory store"
|
196
|
+
notes:
|
197
|
+
multiprocess: in-memory multiprocess caveat
|
198
|
+
- adapter: LRUHash
|
199
|
+
platforms: [ MRI, JRuby ]
|
200
|
+
features: [ multiprocess, increment, create, each_key ]
|
201
|
+
description: "LRU memory store"
|
202
|
+
notes:
|
203
|
+
multiprocess: in-memory multiprocess caveat
|
204
|
+
- adapter: Memory
|
205
|
+
platforms: [ MRI, JRuby ]
|
206
|
+
features: [ multiprocess, increment, create, each_key, bulk_read, bulk_write ]
|
207
|
+
description: Memory store
|
208
|
+
notes:
|
209
|
+
multiprocess: in-memory multiprocess caveat
|
210
|
+
- adapter: "Null"
|
211
|
+
platforms: [ MRI, JRuby ]
|
212
|
+
features: [ threadsafe, multiprocess ]
|
213
|
+
description: "No database"
|
214
|
+
---
|
215
|
+
group: Network clients
|
216
|
+
notes:
|
217
|
+
depends on server: Depends on server
|
218
|
+
backends:
|
219
|
+
- adapter: Client
|
220
|
+
platforms: [ MRI, JRuby ]
|
221
|
+
features: [multiprocess]
|
222
|
+
unknown: [ increment, create, expires, persist ]
|
223
|
+
description: "Moneta client adapter"
|
224
|
+
notes:
|
225
|
+
increment: depends on server
|
226
|
+
create: depends on server
|
227
|
+
expires: depends on server
|
228
|
+
persist: depends on server
|
229
|
+
- adapter: RestClient
|
230
|
+
platforms: [ MRI, JRuby ]
|
231
|
+
features: [ multiprocess ]
|
232
|
+
unknown: [ persist ]
|
233
|
+
description: "Moneta REST client adapter"
|
234
|
+
notes:
|
235
|
+
persist: depends on server
|
@@ -12,14 +12,14 @@ module ActiveSupport
|
|
12
12
|
def increment(key, amount = 1, options = nil)
|
13
13
|
options = merged_options(options)
|
14
14
|
instrument(:increment, key, amount: amount) do
|
15
|
-
@store.increment(
|
15
|
+
@store.increment(normalize_key(key, options), amount, moneta_options(options))
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
19
|
def decrement(key, amount = 1, options = nil)
|
20
20
|
options = merged_options(options)
|
21
21
|
instrument(:decrement, key, amount: amount) do
|
22
|
-
@store.increment(
|
22
|
+
@store.increment(normalize_key(key, options), -amount, moneta_options(options))
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -30,11 +30,79 @@ module ActiveSupport
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
# This prevents underlying Moneta transformers from erroring on raw values
|
34
|
+
def exist?(name, options = {})
|
35
|
+
super
|
36
|
+
rescue
|
37
|
+
super(name, options.merge(raw: true))
|
38
|
+
end
|
39
|
+
|
40
|
+
# These are the rails 5.2 versions of these methods, which call into the
|
41
|
+
# lower-level read_multi_entries and write_multi_entries methods. We
|
42
|
+
# define them here only if the superclass versions don't use the *_entries
|
43
|
+
# methods.
|
44
|
+
unless [:read_multi_entries, :write_multi_entries].all? { |m| superclass.private_instance_methods.include? m }
|
45
|
+
def fetch_multi(*names)
|
46
|
+
raise ArgumentError, "Missing block: `Cache#fetch_multi` requires a block." \
|
47
|
+
unless block_given?
|
48
|
+
|
49
|
+
options = names.extract_options!
|
50
|
+
options = merged_options(options)
|
51
|
+
|
52
|
+
instrument :read_multi, names, options do |payload|
|
53
|
+
read_multi_entries(names, options).tap do |results|
|
54
|
+
payload[:hits] = results.keys
|
55
|
+
payload[:super_operation] = :fetch_multi
|
56
|
+
|
57
|
+
writes = {}
|
58
|
+
|
59
|
+
(names - results.keys).each do |name|
|
60
|
+
results[name] = writes[name] = yield(name)
|
61
|
+
end
|
62
|
+
|
63
|
+
write_multi writes, options
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def read_multi(*names)
|
69
|
+
options = names.extract_options!
|
70
|
+
options = merged_options(options)
|
71
|
+
|
72
|
+
instrument :read_multi, names, options do |payload|
|
73
|
+
read_multi_entries(names, options).tap do |results|
|
74
|
+
payload[:hits] = results.keys
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def write_multi(hash, options = nil)
|
80
|
+
options = merged_options(options)
|
81
|
+
|
82
|
+
instrument :write_multi, hash, options do |payload|
|
83
|
+
entries = hash.each_with_object({}) do |(name, value), memo|
|
84
|
+
memo[normalize_key(name, options)] = \
|
85
|
+
Entry.new(value, options.merge(version: normalize_version(name, options)))
|
86
|
+
end
|
87
|
+
|
88
|
+
write_multi_entries entries, options
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
33
93
|
protected
|
34
94
|
|
95
|
+
def make_entry(value)
|
96
|
+
case value
|
97
|
+
when ActiveSupport::Cache::Entry, nil
|
98
|
+
value
|
99
|
+
else
|
100
|
+
ActiveSupport::Cache::Entry.new(value)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
35
104
|
def read_entry(key, options)
|
36
|
-
|
37
|
-
entry && (ActiveSupport::Cache::Entry === entry ? entry : ActiveSupport::Cache::Entry.new(entry))
|
105
|
+
make_entry(@store.load(key, moneta_options(options, false)))
|
38
106
|
end
|
39
107
|
|
40
108
|
def write_entry(key, entry, options)
|
@@ -48,11 +116,39 @@ module ActiveSupport
|
|
48
116
|
true
|
49
117
|
end
|
50
118
|
|
119
|
+
def read_multi_entries(names, options)
|
120
|
+
keys = names.map { |name| normalize_key(name, options) }
|
121
|
+
entries = @store.
|
122
|
+
values_at(*keys, **moneta_options(options, false)).
|
123
|
+
map(&method(:make_entry))
|
124
|
+
|
125
|
+
names.zip(keys, entries).map do |name, key, entry|
|
126
|
+
next if entry.nil?
|
127
|
+
delete_entry(key, options) if entry.expired?
|
128
|
+
next if entry.expired? || entry.mismatched?(normalize_version(name, options))
|
129
|
+
|
130
|
+
[name, entry.value]
|
131
|
+
end.compact.to_h
|
132
|
+
end
|
133
|
+
|
134
|
+
def write_multi_entries(hash, options)
|
135
|
+
pairs = if options[:raw]
|
136
|
+
hash.transform_values { |entry| entry.value.to_s }
|
137
|
+
else
|
138
|
+
hash
|
139
|
+
end
|
140
|
+
|
141
|
+
@store.merge!(pairs, moneta_options(options))
|
142
|
+
hash
|
143
|
+
end
|
144
|
+
|
51
145
|
private
|
52
146
|
|
53
|
-
def moneta_options(options)
|
147
|
+
def moneta_options(options, include_expires = true)
|
54
148
|
new_options = options ? options.dup : {}
|
55
|
-
|
149
|
+
if new_options.include?(:expires_in) and include_expires
|
150
|
+
new_options[:expires] = new_options.delete(:expires_in).to_r
|
151
|
+
end
|
56
152
|
new_options
|
57
153
|
end
|
58
154
|
end
|