moneta 0.7.6 → 0.7.8
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +15 -0
- data/README.md +160 -50
- data/Rakefile +11 -2
- data/SPEC.md +7 -2
- data/lib/moneta.rb +7 -1
- data/lib/moneta/adapters/activerecord.rb +27 -3
- data/lib/moneta/adapters/cassandra.rb +1 -1
- data/lib/moneta/adapters/client.rb +8 -2
- data/lib/moneta/adapters/cookie.rb +1 -1
- data/lib/moneta/adapters/couch.rb +2 -1
- data/lib/moneta/adapters/datamapper.rb +16 -0
- data/lib/moneta/adapters/daybreak.rb +19 -1
- data/lib/moneta/adapters/file.rb +12 -0
- data/lib/moneta/adapters/hbase.rb +1 -2
- data/lib/moneta/adapters/lruhash.rb +4 -1
- data/lib/moneta/adapters/memcached.rb +7 -3
- data/lib/moneta/adapters/memcached/dalli.rb +8 -2
- data/lib/moneta/adapters/memcached/native.rb +10 -3
- data/lib/moneta/adapters/memory.rb +1 -0
- data/lib/moneta/adapters/mongo.rb +32 -5
- data/lib/moneta/adapters/pstore.rb +13 -2
- data/lib/moneta/adapters/redis.rb +19 -0
- data/lib/moneta/adapters/restclient.rb +1 -1
- data/lib/moneta/adapters/sequel.rb +20 -6
- data/lib/moneta/adapters/sqlite.rb +13 -1
- data/lib/moneta/adapters/tokyocabinet.rb +5 -0
- data/lib/moneta/cache.rb +10 -0
- data/lib/moneta/expires.rb +19 -22
- data/lib/moneta/lock.rb +2 -2
- data/lib/moneta/mixins.rb +33 -11
- data/lib/moneta/optionmerger.rb +1 -1
- data/lib/moneta/proxy.rb +13 -8
- data/lib/moneta/server.rb +13 -6
- data/lib/moneta/shared.rb +6 -10
- data/lib/moneta/synchronize.rb +125 -0
- data/lib/moneta/transformer.rb +50 -42
- data/lib/moneta/transformer/config.rb +34 -32
- data/lib/moneta/utils.rb +20 -0
- data/lib/moneta/version.rb +1 -1
- data/lib/moneta/weak.rb +17 -0
- data/lib/moneta/wrapper.rb +5 -0
- data/lib/rack/moneta_cookies.rb +2 -2
- data/lib/rack/moneta_store.rb +4 -4
- data/script/benchmarks +3 -9
- data/script/generate-specs +278 -41
- data/script/install-bundle +2 -2
- data/spec/moneta/adapter_activerecord_spec.rb +1 -0
- data/spec/moneta/adapter_cassandra_spec.rb +1 -0
- data/spec/moneta/adapter_cassandra_with_default_expires_spec.rb +1 -0
- data/spec/moneta/adapter_client_spec.rb +1 -0
- data/spec/moneta/adapter_cookie_spec.rb +1 -0
- data/spec/moneta/adapter_couch_spec.rb +1 -0
- data/spec/moneta/adapter_datamapper_spec.rb +1 -0
- data/spec/moneta/adapter_daybreak_spec.rb +1 -0
- data/spec/moneta/adapter_dbm_spec.rb +1 -0
- data/spec/moneta/adapter_file_spec.rb +1 -0
- data/spec/moneta/adapter_fog_spec.rb +1 -0
- data/spec/moneta/adapter_gdbm_spec.rb +1 -1
- data/spec/moneta/adapter_hbase_spec.rb +1 -0
- data/spec/moneta/adapter_leveldb_spec.rb +1 -0
- data/spec/moneta/adapter_localmemcache_spec.rb +1 -0
- data/spec/moneta/adapter_lruhash_spec.rb +1 -0
- data/spec/moneta/adapter_memcached_dalli_spec.rb +2 -0
- data/spec/moneta/adapter_memcached_dalli_with_default_expires_spec.rb +2 -0
- data/spec/moneta/adapter_memcached_native_spec.rb +2 -0
- data/spec/moneta/adapter_memcached_native_with_default_expires_spec.rb +2 -0
- data/spec/moneta/adapter_memcached_spec.rb +2 -0
- data/spec/moneta/adapter_memcached_with_default_expires_spec.rb +2 -0
- data/spec/moneta/adapter_memory_spec.rb +1 -0
- data/spec/moneta/adapter_mongo_spec.rb +2 -0
- data/spec/moneta/adapter_mongo_with_default_expires_spec.rb +2 -0
- data/spec/moneta/adapter_pstore_spec.rb +1 -0
- data/spec/moneta/adapter_redis_spec.rb +2 -0
- data/spec/moneta/adapter_redis_with_default_expires_spec.rb +2 -0
- data/spec/moneta/adapter_restclient_spec.rb +1 -0
- data/spec/moneta/adapter_riak_spec.rb +1 -0
- data/spec/moneta/adapter_sdbm_spec.rb +1 -0
- data/spec/moneta/adapter_sequel_spec.rb +1 -0
- data/spec/moneta/adapter_sqlite_spec.rb +1 -0
- data/spec/moneta/adapter_tdb_spec.rb +1 -0
- data/spec/moneta/adapter_tokyocabinet_bdb_spec.rb +1 -0
- data/spec/moneta/adapter_tokyocabinet_hdb_spec.rb +1 -0
- data/spec/moneta/adapter_yaml_spec.rb +1 -0
- data/spec/moneta/cache_file_memory_spec.rb +1 -0
- data/spec/moneta/cache_memory_null_spec.rb +1 -0
- data/spec/moneta/expires_file_spec.rb +3 -1
- data/spec/moneta/expires_memory_spec.rb +2 -0
- data/spec/moneta/expires_memory_with_default_expires_spec.rb +2 -0
- data/spec/moneta/lock_spec.rb +1 -0
- data/spec/moneta/mutex_spec.rb +71 -0
- data/spec/moneta/null_adapter_spec.rb +1 -0
- data/spec/moneta/optionmerger_spec.rb +5 -7
- data/spec/moneta/pool_spec.rb +1 -0
- data/spec/moneta/proxy_expires_memory_spec.rb +2 -0
- data/spec/moneta/proxy_redis_spec.rb +2 -0
- data/spec/moneta/semaphore_spec.rb +84 -0
- data/spec/moneta/{shared_spec.rb → shared_tcp_spec.rb} +4 -3
- data/spec/moneta/shared_unix_spec.rb +37 -0
- data/spec/moneta/simple_activerecord_spec.rb +1 -0
- data/spec/moneta/simple_activerecord_with_expires_spec.rb +3 -1
- data/spec/moneta/simple_cassandra_spec.rb +1 -0
- data/spec/moneta/simple_client_tcp_spec.rb +1 -0
- data/spec/moneta/simple_client_unix_spec.rb +3 -2
- data/spec/moneta/simple_couch_spec.rb +1 -0
- data/spec/moneta/simple_couch_with_expires_spec.rb +2 -1
- data/spec/moneta/simple_datamapper_spec.rb +1 -0
- data/spec/moneta/simple_datamapper_with_expires_spec.rb +3 -1
- data/spec/moneta/simple_datamapper_with_repository_spec.rb +1 -0
- data/spec/moneta/simple_daybreak_spec.rb +1 -0
- data/spec/moneta/simple_daybreak_with_expires_spec.rb +3 -1
- data/spec/moneta/simple_dbm_spec.rb +1 -0
- data/spec/moneta/simple_dbm_with_expires_spec.rb +3 -1
- data/spec/moneta/simple_file_spec.rb +1 -0
- data/spec/moneta/simple_file_with_expires_spec.rb +3 -1
- data/spec/moneta/simple_fog_spec.rb +1 -0
- data/spec/moneta/simple_fog_with_expires_spec.rb +2 -1
- data/spec/moneta/simple_gdbm_spec.rb +1 -0
- data/spec/moneta/simple_gdbm_with_expires_spec.rb +3 -1
- data/spec/moneta/simple_hashfile_spec.rb +1 -0
- data/spec/moneta/simple_hashfile_with_expires_spec.rb +3 -1
- data/spec/moneta/simple_hbase_spec.rb +1 -0
- data/spec/moneta/simple_hbase_with_expires_spec.rb +3 -1
- data/spec/moneta/simple_leveldb_spec.rb +1 -0
- data/spec/moneta/simple_leveldb_with_expires_spec.rb +3 -1
- data/spec/moneta/simple_localmemcache_spec.rb +1 -0
- data/spec/moneta/simple_localmemcache_with_expires_spec.rb +2 -1
- data/spec/moneta/simple_lruhash_spec.rb +1 -0
- data/spec/moneta/simple_lruhash_with_expires_spec.rb +3 -1
- data/spec/moneta/simple_memcached_dalli_spec.rb +2 -0
- data/spec/moneta/simple_memcached_native_spec.rb +2 -0
- data/spec/moneta/simple_memcached_spec.rb +2 -0
- data/spec/moneta/simple_memory_spec.rb +1 -0
- data/spec/moneta/simple_memory_with_compress_spec.rb +1 -0
- data/spec/moneta/simple_memory_with_expires_spec.rb +3 -1
- data/spec/moneta/simple_memory_with_json_key_serializer_spec.rb +1 -0
- data/spec/moneta/simple_memory_with_json_serializer_spec.rb +1 -0
- data/spec/moneta/simple_memory_with_json_value_serializer_spec.rb +1 -0
- data/spec/moneta/simple_memory_with_prefix_spec.rb +1 -0
- data/spec/moneta/simple_memory_with_snappy_compress_spec.rb +1 -0
- data/spec/moneta/simple_mongo_spec.rb +2 -0
- data/spec/moneta/simple_null_spec.rb +1 -0
- data/spec/moneta/simple_pstore_spec.rb +1 -0
- data/spec/moneta/simple_pstore_with_expires_spec.rb +3 -1
- data/spec/moneta/simple_redis_spec.rb +2 -0
- data/spec/moneta/simple_restclient_spec.rb +1 -0
- data/spec/moneta/simple_riak_spec.rb +1 -0
- data/spec/moneta/simple_riak_with_expires_spec.rb +2 -1
- data/spec/moneta/simple_sdbm_spec.rb +1 -0
- data/spec/moneta/simple_sdbm_with_expires_spec.rb +3 -1
- data/spec/moneta/simple_sequel_spec.rb +1 -0
- data/spec/moneta/simple_sequel_with_expires_spec.rb +3 -1
- data/spec/moneta/simple_sqlite_spec.rb +1 -0
- data/spec/moneta/simple_sqlite_with_expires_spec.rb +3 -1
- data/spec/moneta/simple_tdb_spec.rb +1 -0
- data/spec/moneta/simple_tdb_with_expires_spec.rb +3 -1
- data/spec/moneta/simple_tokyocabinet_spec.rb +1 -0
- data/spec/moneta/simple_tokyocabinet_with_expires_spec.rb +3 -1
- data/spec/moneta/simple_yaml_spec.rb +1 -0
- data/spec/moneta/simple_yaml_with_expires_spec.rb +3 -1
- data/spec/moneta/stack_file_memory_spec.rb +1 -0
- data/spec/moneta/stack_memory_file_spec.rb +1 -0
- data/spec/moneta/transformer_bencode_spec.rb +1 -0
- data/spec/moneta/transformer_bert_spec.rb +1 -0
- data/spec/moneta/transformer_bson_spec.rb +1 -0
- data/spec/moneta/transformer_bzip2_spec.rb +1 -0
- data/spec/moneta/transformer_json_spec.rb +1 -0
- data/spec/moneta/transformer_key_inspect_spec.rb +73 -0
- data/spec/moneta/transformer_key_marshal_spec.rb +1 -0
- data/spec/moneta/transformer_key_to_s_spec.rb +1 -0
- data/spec/moneta/transformer_key_yaml_spec.rb +1 -0
- data/spec/moneta/transformer_lzma_spec.rb +1 -0
- data/spec/moneta/transformer_lzo_spec.rb +1 -0
- data/spec/moneta/transformer_marshal_base64_spec.rb +1 -0
- data/spec/moneta/transformer_marshal_escape_spec.rb +1 -0
- data/spec/moneta/transformer_marshal_hmac_spec.rb +1 -0
- data/spec/moneta/transformer_marshal_md5_spec.rb +1 -0
- data/spec/moneta/transformer_marshal_md5_spread_spec.rb +1 -0
- data/spec/moneta/transformer_marshal_prefix_spec.rb +1 -0
- data/spec/moneta/transformer_marshal_rmd160_spec.rb +1 -0
- data/spec/moneta/transformer_marshal_sha1_spec.rb +1 -0
- data/spec/moneta/transformer_marshal_sha256_spec.rb +1 -0
- data/spec/moneta/transformer_marshal_sha384_spec.rb +1 -0
- data/spec/moneta/transformer_marshal_sha512_spec.rb +1 -0
- data/spec/moneta/transformer_marshal_spec.rb +1 -0
- data/spec/moneta/transformer_marshal_truncate_spec.rb +1 -0
- data/spec/moneta/transformer_marshal_uuencode_spec.rb +1 -0
- data/spec/moneta/transformer_msgpack_spec.rb +1 -0
- data/spec/moneta/transformer_ox_spec.rb +1 -0
- data/spec/moneta/transformer_quicklz_spec.rb +1 -0
- data/spec/moneta/transformer_snappy_spec.rb +1 -0
- data/spec/moneta/transformer_tnet_spec.rb +1 -0
- data/spec/moneta/transformer_value_marshal_spec.rb +1 -0
- data/spec/moneta/transformer_value_yaml_spec.rb +1 -0
- data/spec/moneta/transformer_yaml_spec.rb +1 -0
- data/spec/moneta/transformer_zlib_spec.rb +1 -0
- data/spec/moneta/weak_create_spec.rb +114 -0
- data/spec/moneta/weak_increment_spec.rb +114 -0
- data/spec/monetaspecs.rb +75 -2
- data/spec/rack/moneta_cookies_spec.rb +1 -1
- metadata +20 -4
@@ -15,6 +15,8 @@ describe_moneta "simple_tokyocabinet_with_expires" do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
include_context 'setup_store'
|
18
|
+
it_should_behave_like 'create'
|
19
|
+
it_should_behave_like 'create_expires'
|
18
20
|
it_should_behave_like 'expires'
|
19
21
|
it_should_behave_like 'increment'
|
20
22
|
it_should_behave_like 'marshallable_key'
|
@@ -145,5 +147,5 @@ describe_moneta "simple_tokyocabinet_with_expires" do
|
|
145
147
|
it_should_behave_like 'store_integerkey_booleanvalue'
|
146
148
|
it_should_behave_like 'store_integerkey_nilvalue'
|
147
149
|
it_should_behave_like 'store_integerkey_integervalue'
|
148
|
-
it_should_behave_like '
|
150
|
+
it_should_behave_like 'transform_value_expires'
|
149
151
|
end
|
@@ -15,6 +15,8 @@ describe_moneta "simple_yaml_with_expires" do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
include_context 'setup_store'
|
18
|
+
it_should_behave_like 'create'
|
19
|
+
it_should_behave_like 'create_expires'
|
18
20
|
it_should_behave_like 'expires'
|
19
21
|
it_should_behave_like 'increment'
|
20
22
|
it_should_behave_like 'marshallable_key'
|
@@ -145,5 +147,5 @@ describe_moneta "simple_yaml_with_expires" do
|
|
145
147
|
it_should_behave_like 'store_integerkey_booleanvalue'
|
146
148
|
it_should_behave_like 'store_integerkey_nilvalue'
|
147
149
|
it_should_behave_like 'store_integerkey_integervalue'
|
148
|
-
it_should_behave_like '
|
150
|
+
it_should_behave_like 'transform_value_expires'
|
149
151
|
end
|
@@ -23,6 +23,7 @@ describe_moneta "stack_file_memory" do
|
|
23
23
|
|
24
24
|
include_context 'setup_store'
|
25
25
|
it_should_behave_like 'multiprocess'
|
26
|
+
it_should_behave_like 'not_create'
|
26
27
|
it_should_behave_like 'not_increment'
|
27
28
|
it_should_behave_like 'null_stringkey_stringvalue'
|
28
29
|
it_should_behave_like 'persist_stringkey_stringvalue'
|
@@ -23,6 +23,7 @@ describe_moneta "stack_memory_file" do
|
|
23
23
|
|
24
24
|
include_context 'setup_store'
|
25
25
|
it_should_behave_like 'multiprocess'
|
26
|
+
it_should_behave_like 'not_create'
|
26
27
|
it_should_behave_like 'not_increment'
|
27
28
|
it_should_behave_like 'null_stringkey_stringvalue'
|
28
29
|
it_should_behave_like 'persist_stringkey_stringvalue'
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# Generated by generate-specs
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
describe_moneta "transformer_key_inspect" do
|
5
|
+
def log
|
6
|
+
@log ||= File.open(File.join(make_tempdir, 'transformer_key_inspect.log'), 'a')
|
7
|
+
end
|
8
|
+
|
9
|
+
def new_store
|
10
|
+
Moneta.build do
|
11
|
+
use :Transformer, :key => :inspect
|
12
|
+
adapter :Memory
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def load_value(value)
|
17
|
+
value
|
18
|
+
end
|
19
|
+
|
20
|
+
include_context 'setup_store'
|
21
|
+
it_should_behave_like 'create'
|
22
|
+
it_should_behave_like 'increment'
|
23
|
+
it_should_behave_like 'null_stringkey_objectvalue'
|
24
|
+
it_should_behave_like 'null_stringkey_stringvalue'
|
25
|
+
it_should_behave_like 'null_stringkey_hashvalue'
|
26
|
+
it_should_behave_like 'null_stringkey_booleanvalue'
|
27
|
+
it_should_behave_like 'null_stringkey_nilvalue'
|
28
|
+
it_should_behave_like 'null_stringkey_integervalue'
|
29
|
+
it_should_behave_like 'null_hashkey_objectvalue'
|
30
|
+
it_should_behave_like 'null_hashkey_stringvalue'
|
31
|
+
it_should_behave_like 'null_hashkey_hashvalue'
|
32
|
+
it_should_behave_like 'null_hashkey_booleanvalue'
|
33
|
+
it_should_behave_like 'null_hashkey_nilvalue'
|
34
|
+
it_should_behave_like 'null_hashkey_integervalue'
|
35
|
+
it_should_behave_like 'null_integerkey_objectvalue'
|
36
|
+
it_should_behave_like 'null_integerkey_stringvalue'
|
37
|
+
it_should_behave_like 'null_integerkey_hashvalue'
|
38
|
+
it_should_behave_like 'null_integerkey_booleanvalue'
|
39
|
+
it_should_behave_like 'null_integerkey_nilvalue'
|
40
|
+
it_should_behave_like 'null_integerkey_integervalue'
|
41
|
+
it_should_behave_like 'returnsame_stringkey_objectvalue'
|
42
|
+
it_should_behave_like 'returnsame_stringkey_stringvalue'
|
43
|
+
it_should_behave_like 'returnsame_stringkey_hashvalue'
|
44
|
+
it_should_behave_like 'returnsame_hashkey_objectvalue'
|
45
|
+
it_should_behave_like 'returnsame_hashkey_stringvalue'
|
46
|
+
it_should_behave_like 'returnsame_hashkey_hashvalue'
|
47
|
+
it_should_behave_like 'returnsame_integerkey_objectvalue'
|
48
|
+
it_should_behave_like 'returnsame_integerkey_stringvalue'
|
49
|
+
it_should_behave_like 'returnsame_integerkey_hashvalue'
|
50
|
+
it_should_behave_like 'store_stringkey_objectvalue'
|
51
|
+
it_should_behave_like 'store_stringkey_stringvalue'
|
52
|
+
it_should_behave_like 'store_stringkey_hashvalue'
|
53
|
+
it_should_behave_like 'store_stringkey_booleanvalue'
|
54
|
+
it_should_behave_like 'store_stringkey_nilvalue'
|
55
|
+
it_should_behave_like 'store_stringkey_integervalue'
|
56
|
+
it_should_behave_like 'store_hashkey_objectvalue'
|
57
|
+
it_should_behave_like 'store_hashkey_stringvalue'
|
58
|
+
it_should_behave_like 'store_hashkey_hashvalue'
|
59
|
+
it_should_behave_like 'store_hashkey_booleanvalue'
|
60
|
+
it_should_behave_like 'store_hashkey_nilvalue'
|
61
|
+
it_should_behave_like 'store_hashkey_integervalue'
|
62
|
+
it_should_behave_like 'store_integerkey_objectvalue'
|
63
|
+
it_should_behave_like 'store_integerkey_stringvalue'
|
64
|
+
it_should_behave_like 'store_integerkey_hashvalue'
|
65
|
+
it_should_behave_like 'store_integerkey_booleanvalue'
|
66
|
+
it_should_behave_like 'store_integerkey_nilvalue'
|
67
|
+
it_should_behave_like 'store_integerkey_integervalue'
|
68
|
+
it_should_behave_like 'transform_value'
|
69
|
+
it 'compile transformer class' do
|
70
|
+
store.should_not be_nil
|
71
|
+
Moneta::Transformer::InspectKey.should_not be_nil
|
72
|
+
end
|
73
|
+
end
|
@@ -18,6 +18,7 @@ describe_moneta "transformer_key_marshal" do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
include_context 'setup_store'
|
21
|
+
it_should_behave_like 'create'
|
21
22
|
it_should_behave_like 'increment'
|
22
23
|
it_should_behave_like 'null_objectkey_objectvalue'
|
23
24
|
it_should_behave_like 'null_objectkey_stringvalue'
|
@@ -18,6 +18,7 @@ describe_moneta "transformer_key_to_s" do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
include_context 'setup_store'
|
21
|
+
it_should_behave_like 'create'
|
21
22
|
it_should_behave_like 'increment'
|
22
23
|
it_should_behave_like 'null_stringkey_objectvalue'
|
23
24
|
it_should_behave_like 'null_stringkey_stringvalue'
|
@@ -18,6 +18,7 @@ describe_moneta "transformer_key_yaml" do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
include_context 'setup_store'
|
21
|
+
it_should_behave_like 'create'
|
21
22
|
it_should_behave_like 'increment'
|
22
23
|
it_should_behave_like 'null_objectkey_objectvalue'
|
23
24
|
it_should_behave_like 'null_objectkey_stringvalue'
|
@@ -18,6 +18,7 @@ describe_moneta "transformer_marshal" do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
include_context 'setup_store'
|
21
|
+
it_should_behave_like 'create'
|
21
22
|
it_should_behave_like 'increment'
|
22
23
|
it_should_behave_like 'null_objectkey_objectvalue'
|
23
24
|
it_should_behave_like 'null_objectkey_stringvalue'
|
@@ -18,6 +18,7 @@ describe_moneta "transformer_quicklz" do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
include_context 'setup_store'
|
21
|
+
it_should_behave_like 'create'
|
21
22
|
it_should_behave_like 'increment'
|
22
23
|
it_should_behave_like 'null_objectkey_stringvalue'
|
23
24
|
it_should_behave_like 'null_stringkey_stringvalue'
|
@@ -18,6 +18,7 @@ describe_moneta "transformer_value_marshal" do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
include_context 'setup_store'
|
21
|
+
it_should_behave_like 'create'
|
21
22
|
it_should_behave_like 'increment'
|
22
23
|
it_should_behave_like 'null_objectkey_objectvalue'
|
23
24
|
it_should_behave_like 'null_objectkey_stringvalue'
|
@@ -18,6 +18,7 @@ describe_moneta "transformer_value_yaml" do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
include_context 'setup_store'
|
21
|
+
it_should_behave_like 'create'
|
21
22
|
it_should_behave_like 'increment'
|
22
23
|
it_should_behave_like 'null_objectkey_objectvalue'
|
23
24
|
it_should_behave_like 'null_objectkey_stringvalue'
|