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
@@ -28,7 +28,7 @@ describe_moneta "adapter_lruhash" do
|
|
28
28
|
it_should_behave_like 'store_pathkey_stringvalue'
|
29
29
|
it_should_behave_like 'store_large'
|
30
30
|
it 'deletes oldest' do
|
31
|
-
store = Moneta::Adapters::LRUHash.new(:
|
31
|
+
store = Moneta::Adapters::LRUHash.new(max_size: 10)
|
32
32
|
store[0] = 'y'
|
33
33
|
(1..1000).each do |i|
|
34
34
|
store[i] = 'x'
|
@@ -8,7 +8,7 @@ describe_moneta "adapter_memcached_native" do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def new_store
|
11
|
-
Moneta::Adapters::MemcachedNative.new(:
|
11
|
+
Moneta::Adapters::MemcachedNative.new(namespace: "adapter_memcached_native")
|
12
12
|
end
|
13
13
|
|
14
14
|
def load_value(value)
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# coding: binary
|
2
|
+
# Generated by generate-specs
|
3
|
+
require 'helper'
|
4
|
+
|
5
|
+
describe_moneta "adapter_mongo_moped" do
|
6
|
+
def features
|
7
|
+
[:create, :expires, :increment]
|
8
|
+
end
|
9
|
+
|
10
|
+
def new_store
|
11
|
+
Moneta::Adapters::MongoMoped.new(db: "adapter_mongo")
|
12
|
+
end
|
13
|
+
|
14
|
+
def load_value(value)
|
15
|
+
Marshal.load(value)
|
16
|
+
end
|
17
|
+
|
18
|
+
include_context 'setup_store'
|
19
|
+
it_should_behave_like 'concurrent_create'
|
20
|
+
it_should_behave_like 'concurrent_increment'
|
21
|
+
it_should_behave_like 'create'
|
22
|
+
it_should_behave_like 'create_expires'
|
23
|
+
it_should_behave_like 'expires'
|
24
|
+
it_should_behave_like 'features'
|
25
|
+
it_should_behave_like 'increment'
|
26
|
+
it_should_behave_like 'multiprocess'
|
27
|
+
it_should_behave_like 'null_stringkey_stringvalue'
|
28
|
+
it_should_behave_like 'null_stringkey_hashvalue'
|
29
|
+
it_should_behave_like 'null_stringkey_integervalue'
|
30
|
+
it_should_behave_like 'null_pathkey_stringvalue'
|
31
|
+
it_should_behave_like 'null_pathkey_hashvalue'
|
32
|
+
it_should_behave_like 'null_pathkey_integervalue'
|
33
|
+
it_should_behave_like 'persist_stringkey_stringvalue'
|
34
|
+
it_should_behave_like 'persist_stringkey_hashvalue'
|
35
|
+
it_should_behave_like 'persist_stringkey_integervalue'
|
36
|
+
it_should_behave_like 'persist_pathkey_stringvalue'
|
37
|
+
it_should_behave_like 'persist_pathkey_hashvalue'
|
38
|
+
it_should_behave_like 'persist_pathkey_integervalue'
|
39
|
+
it_should_behave_like 'returndifferent_stringkey_stringvalue'
|
40
|
+
it_should_behave_like 'returndifferent_stringkey_hashvalue'
|
41
|
+
it_should_behave_like 'returndifferent_pathkey_stringvalue'
|
42
|
+
it_should_behave_like 'returndifferent_pathkey_hashvalue'
|
43
|
+
it_should_behave_like 'store_stringkey_stringvalue'
|
44
|
+
it_should_behave_like 'store_stringkey_hashvalue'
|
45
|
+
it_should_behave_like 'store_stringkey_integervalue'
|
46
|
+
it_should_behave_like 'store_pathkey_stringvalue'
|
47
|
+
it_should_behave_like 'store_pathkey_hashvalue'
|
48
|
+
it_should_behave_like 'store_pathkey_integervalue'
|
49
|
+
it_should_behave_like 'store_large'
|
50
|
+
it 'automatically deletes expired document' do
|
51
|
+
store.store('key', 'val', expires: 5)
|
52
|
+
store.instance_variable_get(:@collection).find('_id' => ::Moped::BSON::Binary.new(:generic, 'key')).one.should_not be_nil
|
53
|
+
sleep 70 # Mongo needs up to 60 seconds
|
54
|
+
store.instance_variable_get(:@collection).find('_id' => ::Moped::BSON::Binary.new(:generic, 'key')).one.should be_nil
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# coding: binary
|
2
|
+
# Generated by generate-specs
|
3
|
+
require 'helper'
|
4
|
+
|
5
|
+
describe_moneta "adapter_mongo_moped_with_default_expires" do
|
6
|
+
def features
|
7
|
+
[:create, :expires, :increment]
|
8
|
+
end
|
9
|
+
|
10
|
+
def new_store
|
11
|
+
Moneta::Adapters::MongoMoped.new(expires: 1)
|
12
|
+
end
|
13
|
+
|
14
|
+
def load_value(value)
|
15
|
+
Marshal.load(value)
|
16
|
+
end
|
17
|
+
|
18
|
+
include_context 'setup_store'
|
19
|
+
it_should_behave_like 'concurrent_create'
|
20
|
+
it_should_behave_like 'concurrent_increment'
|
21
|
+
it_should_behave_like 'create'
|
22
|
+
it_should_behave_like 'create_expires'
|
23
|
+
it_should_behave_like 'default_expires'
|
24
|
+
it_should_behave_like 'expires'
|
25
|
+
it_should_behave_like 'features'
|
26
|
+
it_should_behave_like 'increment'
|
27
|
+
it_should_behave_like 'multiprocess'
|
28
|
+
it_should_behave_like 'null_stringkey_stringvalue'
|
29
|
+
it_should_behave_like 'null_stringkey_hashvalue'
|
30
|
+
it_should_behave_like 'null_stringkey_integervalue'
|
31
|
+
it_should_behave_like 'null_pathkey_stringvalue'
|
32
|
+
it_should_behave_like 'null_pathkey_hashvalue'
|
33
|
+
it_should_behave_like 'null_pathkey_integervalue'
|
34
|
+
it_should_behave_like 'persist_stringkey_stringvalue'
|
35
|
+
it_should_behave_like 'persist_stringkey_hashvalue'
|
36
|
+
it_should_behave_like 'persist_stringkey_integervalue'
|
37
|
+
it_should_behave_like 'persist_pathkey_stringvalue'
|
38
|
+
it_should_behave_like 'persist_pathkey_hashvalue'
|
39
|
+
it_should_behave_like 'persist_pathkey_integervalue'
|
40
|
+
it_should_behave_like 'returndifferent_stringkey_stringvalue'
|
41
|
+
it_should_behave_like 'returndifferent_stringkey_hashvalue'
|
42
|
+
it_should_behave_like 'returndifferent_pathkey_stringvalue'
|
43
|
+
it_should_behave_like 'returndifferent_pathkey_hashvalue'
|
44
|
+
it_should_behave_like 'store_stringkey_stringvalue'
|
45
|
+
it_should_behave_like 'store_stringkey_hashvalue'
|
46
|
+
it_should_behave_like 'store_stringkey_integervalue'
|
47
|
+
it_should_behave_like 'store_pathkey_stringvalue'
|
48
|
+
it_should_behave_like 'store_pathkey_hashvalue'
|
49
|
+
it_should_behave_like 'store_pathkey_integervalue'
|
50
|
+
it_should_behave_like 'store_large'
|
51
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# coding: binary
|
2
|
+
# Generated by generate-specs
|
3
|
+
require 'helper'
|
4
|
+
|
5
|
+
describe_moneta "adapter_mongo_official" do
|
6
|
+
def features
|
7
|
+
[:create, :expires, :increment]
|
8
|
+
end
|
9
|
+
|
10
|
+
def new_store
|
11
|
+
Moneta::Adapters::MongoOfficial.new(db: "adapter_mongo")
|
12
|
+
end
|
13
|
+
|
14
|
+
def load_value(value)
|
15
|
+
Marshal.load(value)
|
16
|
+
end
|
17
|
+
|
18
|
+
include_context 'setup_store'
|
19
|
+
it_should_behave_like 'concurrent_create'
|
20
|
+
it_should_behave_like 'concurrent_increment'
|
21
|
+
it_should_behave_like 'create'
|
22
|
+
it_should_behave_like 'create_expires'
|
23
|
+
it_should_behave_like 'expires'
|
24
|
+
it_should_behave_like 'features'
|
25
|
+
it_should_behave_like 'increment'
|
26
|
+
it_should_behave_like 'multiprocess'
|
27
|
+
it_should_behave_like 'null_stringkey_stringvalue'
|
28
|
+
it_should_behave_like 'null_stringkey_hashvalue'
|
29
|
+
it_should_behave_like 'null_stringkey_integervalue'
|
30
|
+
it_should_behave_like 'null_pathkey_stringvalue'
|
31
|
+
it_should_behave_like 'null_pathkey_hashvalue'
|
32
|
+
it_should_behave_like 'null_pathkey_integervalue'
|
33
|
+
it_should_behave_like 'persist_stringkey_stringvalue'
|
34
|
+
it_should_behave_like 'persist_stringkey_hashvalue'
|
35
|
+
it_should_behave_like 'persist_stringkey_integervalue'
|
36
|
+
it_should_behave_like 'persist_pathkey_stringvalue'
|
37
|
+
it_should_behave_like 'persist_pathkey_hashvalue'
|
38
|
+
it_should_behave_like 'persist_pathkey_integervalue'
|
39
|
+
it_should_behave_like 'returndifferent_stringkey_stringvalue'
|
40
|
+
it_should_behave_like 'returndifferent_stringkey_hashvalue'
|
41
|
+
it_should_behave_like 'returndifferent_pathkey_stringvalue'
|
42
|
+
it_should_behave_like 'returndifferent_pathkey_hashvalue'
|
43
|
+
it_should_behave_like 'store_stringkey_stringvalue'
|
44
|
+
it_should_behave_like 'store_stringkey_hashvalue'
|
45
|
+
it_should_behave_like 'store_stringkey_integervalue'
|
46
|
+
it_should_behave_like 'store_pathkey_stringvalue'
|
47
|
+
it_should_behave_like 'store_pathkey_hashvalue'
|
48
|
+
it_should_behave_like 'store_pathkey_integervalue'
|
49
|
+
it_should_behave_like 'store_large'
|
50
|
+
it 'automatically deletes expired document' do
|
51
|
+
store.store('key', 'val', expires: 5)
|
52
|
+
store.instance_variable_get(:@collection).find_one('_id' => ::BSON::Binary.new('key')).should_not be_nil
|
53
|
+
sleep 70 # Mongo needs up to 60 seconds
|
54
|
+
store.instance_variable_get(:@collection).find_one('_id' => ::BSON::Binary.new('key')).should be_nil
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# coding: binary
|
2
|
+
# Generated by generate-specs
|
3
|
+
require 'helper'
|
4
|
+
|
5
|
+
describe_moneta "adapter_mongo_official_with_default_expires" do
|
6
|
+
def features
|
7
|
+
[:create, :expires, :increment]
|
8
|
+
end
|
9
|
+
|
10
|
+
def new_store
|
11
|
+
Moneta::Adapters::MongoOfficial.new(expires: 1)
|
12
|
+
end
|
13
|
+
|
14
|
+
def load_value(value)
|
15
|
+
Marshal.load(value)
|
16
|
+
end
|
17
|
+
|
18
|
+
include_context 'setup_store'
|
19
|
+
it_should_behave_like 'concurrent_create'
|
20
|
+
it_should_behave_like 'concurrent_increment'
|
21
|
+
it_should_behave_like 'create'
|
22
|
+
it_should_behave_like 'create_expires'
|
23
|
+
it_should_behave_like 'default_expires'
|
24
|
+
it_should_behave_like 'expires'
|
25
|
+
it_should_behave_like 'features'
|
26
|
+
it_should_behave_like 'increment'
|
27
|
+
it_should_behave_like 'multiprocess'
|
28
|
+
it_should_behave_like 'null_stringkey_stringvalue'
|
29
|
+
it_should_behave_like 'null_stringkey_hashvalue'
|
30
|
+
it_should_behave_like 'null_stringkey_integervalue'
|
31
|
+
it_should_behave_like 'null_pathkey_stringvalue'
|
32
|
+
it_should_behave_like 'null_pathkey_hashvalue'
|
33
|
+
it_should_behave_like 'null_pathkey_integervalue'
|
34
|
+
it_should_behave_like 'persist_stringkey_stringvalue'
|
35
|
+
it_should_behave_like 'persist_stringkey_hashvalue'
|
36
|
+
it_should_behave_like 'persist_stringkey_integervalue'
|
37
|
+
it_should_behave_like 'persist_pathkey_stringvalue'
|
38
|
+
it_should_behave_like 'persist_pathkey_hashvalue'
|
39
|
+
it_should_behave_like 'persist_pathkey_integervalue'
|
40
|
+
it_should_behave_like 'returndifferent_stringkey_stringvalue'
|
41
|
+
it_should_behave_like 'returndifferent_stringkey_hashvalue'
|
42
|
+
it_should_behave_like 'returndifferent_pathkey_stringvalue'
|
43
|
+
it_should_behave_like 'returndifferent_pathkey_hashvalue'
|
44
|
+
it_should_behave_like 'store_stringkey_stringvalue'
|
45
|
+
it_should_behave_like 'store_stringkey_hashvalue'
|
46
|
+
it_should_behave_like 'store_stringkey_integervalue'
|
47
|
+
it_should_behave_like 'store_pathkey_stringvalue'
|
48
|
+
it_should_behave_like 'store_pathkey_hashvalue'
|
49
|
+
it_should_behave_like 'store_pathkey_integervalue'
|
50
|
+
it_should_behave_like 'store_large'
|
51
|
+
end
|
@@ -8,7 +8,7 @@ describe_moneta "adapter_mongo" do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def new_store
|
11
|
-
Moneta::Adapters::Mongo.new(:
|
11
|
+
Moneta::Adapters::Mongo.new(db: "adapter_mongo")
|
12
12
|
end
|
13
13
|
|
14
14
|
def load_value(value)
|
@@ -47,10 +47,4 @@ describe_moneta "adapter_mongo" do
|
|
47
47
|
it_should_behave_like 'store_pathkey_hashvalue'
|
48
48
|
it_should_behave_like 'store_pathkey_integervalue'
|
49
49
|
it_should_behave_like 'store_large'
|
50
|
-
it 'automatically deletes expired document' do
|
51
|
-
store.store('key', 'val', :expires => 5)
|
52
|
-
store.instance_variable_get(:@collection).find_one('_id' => ::BSON::Binary.new('key')).should_not be_nil
|
53
|
-
sleep 70 # Mongo needs up to 60 seconds
|
54
|
-
store.instance_variable_get(:@collection).find_one('_id' => ::BSON::Binary.new('key')).should be_nil
|
55
|
-
end
|
56
50
|
end
|
@@ -8,7 +8,7 @@ describe_moneta "adapter_sequel" do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def new_store
|
11
|
-
Moneta::Adapters::Sequel.new(:
|
11
|
+
Moneta::Adapters::Sequel.new(db: (defined?(JRUBY_VERSION) ? "jdbc:mysql://localhost/moneta?user=root" : "mysql2://root:@localhost/moneta"), table: "adapter_sequel")
|
12
12
|
end
|
13
13
|
|
14
14
|
def load_value(value)
|
@@ -8,7 +8,7 @@ describe_moneta "adapter_tokyocabinet_bdb" do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def new_store
|
11
|
-
Moneta::Adapters::TokyoCabinet.new(:
|
11
|
+
Moneta::Adapters::TokyoCabinet.new(file: File.join(make_tempdir, "adapter_tokyocabinet_bdb"), type: :bdb)
|
12
12
|
end
|
13
13
|
|
14
14
|
def load_value(value)
|
@@ -8,7 +8,7 @@ describe_moneta "adapter_tokyocabinet_hdb" do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def new_store
|
11
|
-
Moneta::Adapters::TokyoCabinet.new(:
|
11
|
+
Moneta::Adapters::TokyoCabinet.new(file: File.join(make_tempdir, "adapter_tokyocabinet_hdb"), type: :hdb)
|
12
12
|
end
|
13
13
|
|
14
14
|
def load_value(value)
|
@@ -10,7 +10,7 @@ describe_moneta "cache_file_memory" do
|
|
10
10
|
def new_store
|
11
11
|
Moneta.build do
|
12
12
|
use(:Cache) do
|
13
|
-
adapter { adapter :File, :
|
13
|
+
adapter { adapter :File, dir: File.join(make_tempdir, "cache_file_memory") }
|
14
14
|
cache { adapter :Memory }
|
15
15
|
end
|
16
16
|
end
|
@@ -10,8 +10,8 @@ describe_moneta "expires_file" do
|
|
10
10
|
def new_store
|
11
11
|
Moneta.build do
|
12
12
|
use :Expires
|
13
|
-
use :Transformer, :
|
14
|
-
adapter :File, :
|
13
|
+
use :Transformer, key: [:marshal, :escape], value: :marshal
|
14
|
+
adapter :File, dir: File.join(make_tempdir, "expires-file")
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -65,7 +65,7 @@ describe_moneta "expires_file" do
|
|
65
65
|
it_should_behave_like 'store_large'
|
66
66
|
it_should_behave_like 'transform_value_expires'
|
67
67
|
it 'deletes expired value in underlying file storage' do
|
68
|
-
store.store('foo', 'bar', :
|
68
|
+
store.store('foo', 'bar', expires: 2)
|
69
69
|
store['foo'].should == 'bar'
|
70
70
|
sleep 1
|
71
71
|
store['foo'].should == 'bar'
|