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
@@ -0,0 +1,59 @@
|
|
1
|
+
describe 'adapter_activerecord_existing_connection', adapter: :ActiveRecord do
|
2
|
+
before :all do
|
3
|
+
require 'active_record'
|
4
|
+
end
|
5
|
+
|
6
|
+
before do
|
7
|
+
default_env = ActiveRecord::ConnectionHandling::DEFAULT_ENV.call
|
8
|
+
ActiveRecord::Base.configurations = {
|
9
|
+
default_env => {
|
10
|
+
'adapter' => (defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql2'),
|
11
|
+
'database' => mysql_database1,
|
12
|
+
'username' => mysql_username,
|
13
|
+
'password' => mysql_password
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
ActiveRecord::Base.establish_connection
|
18
|
+
end
|
19
|
+
|
20
|
+
moneta_build do
|
21
|
+
Moneta::Adapters::ActiveRecord.new(table: 'adapter_activerecord_existing_connection')
|
22
|
+
end
|
23
|
+
|
24
|
+
moneta_specs ADAPTER_SPECS.with_each_key
|
25
|
+
|
26
|
+
# This is based on
|
27
|
+
# https://github.com/jjb/rails/blob/ar-connection-management-guide/guides/source/active_record_connection_management.md
|
28
|
+
it "supports use on a forking web server", unsupported: !Process.respond_to?(:fork) do
|
29
|
+
store['a'] = 'b'
|
30
|
+
|
31
|
+
# Before forking, the connection pool is disconnected so that the
|
32
|
+
# forked processes don't use the same connections.
|
33
|
+
ActiveRecord::Base.connection_pool.disconnect!
|
34
|
+
|
35
|
+
pids = 8.times.map do
|
36
|
+
Process.fork do
|
37
|
+
# Connection is then reestablished in the forked process
|
38
|
+
ActiveRecord::Base.establish_connection
|
39
|
+
|
40
|
+
exit 1 unless store['a'] == 'b'
|
41
|
+
|
42
|
+
store[Process.pid.to_s] = '1'
|
43
|
+
exit 1 unless store[Process.pid.to_s] == '1'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
pids.each do |pid|
|
48
|
+
pid2, status = Process.wait2(pid)
|
49
|
+
expect(pid2).to eq pid
|
50
|
+
expect(status.exitstatus).to eq 0
|
51
|
+
end
|
52
|
+
|
53
|
+
# Check that the stores were all operating on the same DB
|
54
|
+
ActiveRecord::Base.establish_connection
|
55
|
+
pids.each do |pid|
|
56
|
+
expect(store[pid.to_s]).to eq '1'
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
describe 'adapter_activerecord', adapter: :ActiveRecord do
|
2
|
+
activerecord_specs = ADAPTER_SPECS.with_values(:nil).with_each_key
|
3
|
+
|
4
|
+
shared_examples :adapter_activerecord do |specs|
|
5
|
+
moneta_build do
|
6
|
+
Moneta::Adapters::ActiveRecord.new(
|
7
|
+
table: 'adapter_activerecord',
|
8
|
+
connection: connection1)
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
moneta_specs specs
|
13
|
+
|
14
|
+
it 'updates an existing key/value' do
|
15
|
+
store['foo/bar'] = '1'
|
16
|
+
store['foo/bar'] = '2'
|
17
|
+
store.with_connection do |conn|
|
18
|
+
count = conn.select_value \
|
19
|
+
store.table.
|
20
|
+
where(store.table[:k].eq('foo/bar')).
|
21
|
+
project(store.table[:k].count)
|
22
|
+
expect(count).to eq 1
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'supports different tables same database' do
|
27
|
+
store1 = Moneta::Adapters::ActiveRecord.new(
|
28
|
+
table: 'adapter_activerecord1',
|
29
|
+
connection: connection1)
|
30
|
+
store2 = Moneta::Adapters::ActiveRecord.new(
|
31
|
+
table: 'adapter_activerecord2',
|
32
|
+
connection: connection1)
|
33
|
+
|
34
|
+
store1['key'] = 'value1'
|
35
|
+
store2['key'] = 'value2'
|
36
|
+
store1['key'].should == 'value1'
|
37
|
+
store2['key'].should == 'value2'
|
38
|
+
|
39
|
+
store1.close
|
40
|
+
store2.close
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'supports different databases same table' do
|
44
|
+
store1 = Moneta::Adapters::ActiveRecord.new(
|
45
|
+
table: 'adapter_activerecord',
|
46
|
+
connection: connection1)
|
47
|
+
store2 = Moneta::Adapters::ActiveRecord.new(
|
48
|
+
table: 'adapter_activerecord',
|
49
|
+
connection: connection2)
|
50
|
+
|
51
|
+
store1['key'] = 'value1'
|
52
|
+
store2['key'] = 'value2'
|
53
|
+
store1['key'].should == 'value1'
|
54
|
+
store2['key'].should == 'value2'
|
55
|
+
|
56
|
+
store1.close
|
57
|
+
store2.close
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
context "with MySQL" do
|
62
|
+
let(:connection1) do
|
63
|
+
{
|
64
|
+
adapter: (defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql2'),
|
65
|
+
database: mysql_database1,
|
66
|
+
username: mysql_username
|
67
|
+
}
|
68
|
+
end
|
69
|
+
|
70
|
+
let(:connection2) do
|
71
|
+
{
|
72
|
+
adapter: (defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql2'),
|
73
|
+
database: mysql_database2,
|
74
|
+
username: mysql_username
|
75
|
+
}
|
76
|
+
end
|
77
|
+
|
78
|
+
include_examples :adapter_activerecord, activerecord_specs
|
79
|
+
end
|
80
|
+
|
81
|
+
context "with PostgreSQL" do
|
82
|
+
let(:connection1) do
|
83
|
+
{
|
84
|
+
adapter: (defined?(JRUBY_VERSION) ? 'jdbcpostgresql' : 'postgresql'),
|
85
|
+
database: postgres_database1,
|
86
|
+
username: postgres_username
|
87
|
+
}
|
88
|
+
end
|
89
|
+
|
90
|
+
let(:connection2) do
|
91
|
+
{
|
92
|
+
adapter: (defined?(JRUBY_VERSION) ? 'jdbcpostgresql' : 'postgresql'),
|
93
|
+
database: postgres_database2,
|
94
|
+
username: postgres_username
|
95
|
+
}
|
96
|
+
end
|
97
|
+
|
98
|
+
include_examples :adapter_activerecord, activerecord_specs
|
99
|
+
end
|
100
|
+
|
101
|
+
context "with SQLite" do
|
102
|
+
let(:connection1) do
|
103
|
+
{
|
104
|
+
adapter: (defined?(JRUBY_VERSION) ? 'jdbcsqlite3' : 'sqlite3'),
|
105
|
+
database: File.join(tempdir, 'adapter_activerecord1.db')
|
106
|
+
}
|
107
|
+
end
|
108
|
+
|
109
|
+
let(:connection2) do
|
110
|
+
{
|
111
|
+
adapter: (defined?(JRUBY_VERSION) ? 'jdbcsqlite3' : 'sqlite3'),
|
112
|
+
database: File.join(tempdir, 'adapter_activerecord2.db')
|
113
|
+
}
|
114
|
+
end
|
115
|
+
|
116
|
+
include_examples :adapter_activerecord, activerecord_specs.without_concurrent
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
describe "standard_activerecord", adapter: :ActiveRecord do
|
2
|
+
moneta_store :ActiveRecord do
|
3
|
+
{
|
4
|
+
table: 'standard_activerecord',
|
5
|
+
connection: {
|
6
|
+
adapter: (defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql2'),
|
7
|
+
database: mysql_database1,
|
8
|
+
username: mysql_username
|
9
|
+
}
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
13
|
+
moneta_loader do |value|
|
14
|
+
::Marshal.load(value.unpack('m').first)
|
15
|
+
end
|
16
|
+
|
17
|
+
moneta_specs STANDARD_SPECS
|
18
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
describe "standard_activerecord_with_expires", adapter: :ActiveRecord do
|
2
|
+
let(:t_res) { 0.125 }
|
3
|
+
let(:min_ttl) { t_res }
|
4
|
+
use_timecop
|
5
|
+
|
6
|
+
moneta_store :ActiveRecord do
|
7
|
+
{
|
8
|
+
table: 'standard_activerecord_with_expires',
|
9
|
+
connection: {
|
10
|
+
adapter: (defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql2'),
|
11
|
+
database: mysql_database1,
|
12
|
+
username: mysql_username
|
13
|
+
},
|
14
|
+
expires: true
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
moneta_loader do |value|
|
20
|
+
::Marshal.load(value.unpack('m').first)
|
21
|
+
end
|
22
|
+
|
23
|
+
moneta_specs STANDARD_SPECS.with_expires
|
24
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
describe 'adapter_activesupportcache', adapter: :ActiveSupportCache do
|
2
|
+
before :all do
|
3
|
+
require 'active_support'
|
4
|
+
require 'active_support/cache/moneta_store'
|
5
|
+
end
|
6
|
+
|
7
|
+
shared_examples :adapter_activesupportcache do
|
8
|
+
moneta_build do
|
9
|
+
Moneta::Adapters::ActiveSupportCache.new(backend: backend)
|
10
|
+
end
|
11
|
+
|
12
|
+
moneta_specs ADAPTER_SPECS.without_concurrent.without_create.with_native_expires
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'using MemoryStore' do
|
16
|
+
let(:t_res) { 0.125 }
|
17
|
+
let(:min_ttl) { t_res }
|
18
|
+
use_timecop
|
19
|
+
|
20
|
+
let(:backend) { ActiveSupport::Cache::MemoryStore.new }
|
21
|
+
include_examples :adapter_activesupportcache
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'using MemCacheStore' do
|
25
|
+
let(:t_res) { 1 }
|
26
|
+
let(:min_ttl) { 2 }
|
27
|
+
use_timecop
|
28
|
+
start_memcached 11215
|
29
|
+
|
30
|
+
let(:backend) { ActiveSupport::Cache::MemCacheStore.new('127.0.0.1:11215') }
|
31
|
+
include_examples :adapter_activesupportcache
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'using RedisCacheStore' do
|
35
|
+
let(:t_res) { 1 }
|
36
|
+
let(:min_ttl) { t_res }
|
37
|
+
use_timecop
|
38
|
+
|
39
|
+
let(:backend) { ActiveSupport::Cache::RedisCacheStore.new(url: 'redis:///1') }
|
40
|
+
include_examples :adapter_activesupportcache
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'using MonetaStore' do
|
44
|
+
let(:t_res) { 0.125 }
|
45
|
+
let(:min_ttl) { t_res }
|
46
|
+
use_timecop
|
47
|
+
|
48
|
+
let(:backend) { ActiveSupport::Cache::MonetaStore.new(store: Moneta.new(:Memory)) }
|
49
|
+
include_examples :adapter_activesupportcache
|
50
|
+
end
|
51
|
+
end
|
data/spec/moneta/adapters/activesupportcache/adapter_activesupportcache_with_default_expires_spec.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
describe 'adapter_activesupportcache_with_default_expires', adapter: :ActiveSupportCache do
|
2
|
+
before :all do
|
3
|
+
require 'active_support'
|
4
|
+
require 'active_support/cache/moneta_store'
|
5
|
+
end
|
6
|
+
|
7
|
+
shared_examples :adapter_activesupportcache_with_default_expires do
|
8
|
+
moneta_build do
|
9
|
+
Moneta::Adapters::ActiveSupportCache.new(backend: backend, expires: min_ttl)
|
10
|
+
end
|
11
|
+
|
12
|
+
moneta_specs ADAPTER_SPECS.without_concurrent.without_create.with_native_expires.with_default_expires
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'using MemoryStore' do
|
16
|
+
let(:t_res) { 0.125 }
|
17
|
+
let(:min_ttl) { t_res }
|
18
|
+
use_timecop
|
19
|
+
|
20
|
+
let(:backend) { ActiveSupport::Cache::MemoryStore.new }
|
21
|
+
include_examples :adapter_activesupportcache_with_default_expires
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'using MemCacheStore' do
|
25
|
+
let(:t_res) { 1 }
|
26
|
+
let(:min_ttl) { 2 }
|
27
|
+
use_timecop
|
28
|
+
start_memcached 11223
|
29
|
+
|
30
|
+
let(:backend) { ActiveSupport::Cache::MemCacheStore.new('127.0.0.1:11223') }
|
31
|
+
include_examples :adapter_activesupportcache_with_default_expires
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'using RedisCacheStore' do
|
35
|
+
let(:t_res) { 1 }
|
36
|
+
let(:min_ttl) { t_res }
|
37
|
+
use_timecop
|
38
|
+
|
39
|
+
let(:backend) { ActiveSupport::Cache::RedisCacheStore.new(url: 'redis:///2') }
|
40
|
+
include_examples :adapter_activesupportcache_with_default_expires
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'using MonetaStore' do
|
44
|
+
let(:t_res) { 0.125 }
|
45
|
+
let(:min_ttl) { t_res }
|
46
|
+
use_timecop
|
47
|
+
|
48
|
+
let(:backend) { ActiveSupport::Cache::MonetaStore.new(store: Moneta.new(:Memory)) }
|
49
|
+
include_examples :adapter_activesupportcache_with_default_expires
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require_relative './helper.rb'
|
2
|
+
|
3
|
+
describe 'adapter_cassandra', retry: 3, adapter: :Cassandra do
|
4
|
+
let(:t_res) { 1 }
|
5
|
+
let(:min_ttl) { 2 }
|
6
|
+
|
7
|
+
include_context :global_cassandra_cluster
|
8
|
+
|
9
|
+
moneta_build do
|
10
|
+
Moneta::Adapters::Cassandra.new(
|
11
|
+
cluster: cluster,
|
12
|
+
keyspace: 'adapter_cassandra',
|
13
|
+
create_keyspace: { durable_writes: false })
|
14
|
+
end
|
15
|
+
|
16
|
+
moneta_specs ADAPTER_SPECS.without_increment.without_create.with_native_expires.with_values(:nil).with_each_key
|
17
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require_relative './helper.rb'
|
2
|
+
|
3
|
+
describe 'adapter_cassandra_with_default_expires', isolate: true, retry: 3, adapter: :Cassandra do
|
4
|
+
let(:t_res) { 1 }
|
5
|
+
let(:min_ttl) { 2 }
|
6
|
+
|
7
|
+
include_context :global_cassandra_cluster
|
8
|
+
|
9
|
+
moneta_build do
|
10
|
+
Moneta::Adapters::Cassandra.new(
|
11
|
+
cluster: cluster,
|
12
|
+
keyspace: 'adapter_cassandra_with_default_expires',
|
13
|
+
expires: min_ttl,
|
14
|
+
create_keyspace: { durable_writes: false })
|
15
|
+
end
|
16
|
+
|
17
|
+
moneta_specs ADAPTER_SPECS.without_increment.without_create.with_native_expires.with_default_expires.with_values(:nil).with_each_key
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# This is used in order to speed up cassandra specs
|
2
|
+
RSpec.shared_context :global_cassandra_cluster do
|
3
|
+
before :all do
|
4
|
+
require 'cassandra'
|
5
|
+
$moneta_cassandra_cluster ||= ::Cassandra.cluster
|
6
|
+
end
|
7
|
+
|
8
|
+
let(:cluster) { $moneta_cassandra_cluster }
|
9
|
+
end
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
config.after :suite do
|
13
|
+
if $moneta_cassandra_cluster
|
14
|
+
$moneta_cassandra_cluster.close
|
15
|
+
$moneta_cassandra_cluster = nil
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require_relative './helper.rb'
|
2
|
+
|
3
|
+
describe "standard_cassandra", retry: 3, adapter: :Cassandra do
|
4
|
+
let(:t_res) { 1 }
|
5
|
+
let(:min_ttl) { 2 }
|
6
|
+
|
7
|
+
include_context :global_cassandra_cluster
|
8
|
+
|
9
|
+
moneta_store :Cassandra do
|
10
|
+
{
|
11
|
+
cluster: cluster,
|
12
|
+
keyspace: "standard_cassandra",
|
13
|
+
create_keyspace: { durable_writes: false }
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
moneta_specs STANDARD_SPECS.without_increment.without_create.with_native_expires
|
18
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
describe "standard_client_tcp", isolate: true, adapter: :Client do
|
2
|
+
before :all do
|
3
|
+
start_server(Moneta::Adapters::Memory.new)
|
4
|
+
end
|
5
|
+
|
6
|
+
moneta_store :Client
|
7
|
+
moneta_specs STANDARD_SPECS
|
8
|
+
|
9
|
+
it 'supports multiple clients' do
|
10
|
+
store['shared_key'] = 'shared_val'
|
11
|
+
threads = (1..100).map do |i|
|
12
|
+
Thread.new do
|
13
|
+
client = new_store
|
14
|
+
(1..100).each do |j|
|
15
|
+
client['shared_key'].should == 'shared_val'
|
16
|
+
client["key-\#{j}-\#{i}"] = "val-\#{j}-\#{i}"
|
17
|
+
client["key-\#{j}-\#{i}"].should == "val-\#{j}-\#{i}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
threads.map(&:join)
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
describe "standard_client_unix", isolate: true, adapter: :Client do
|
2
|
+
before :all do
|
3
|
+
start_server Moneta::Adapters::Memory.new,
|
4
|
+
socket: File.join(tempdir, 'standard_client_unix')
|
5
|
+
end
|
6
|
+
|
7
|
+
moneta_store :Client do
|
8
|
+
{socket: File.join(tempdir, 'standard_client_unix')}
|
9
|
+
end
|
10
|
+
|
11
|
+
moneta_specs STANDARD_SPECS
|
12
|
+
end
|