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
data/script/install-bundle
CHANGED
@@ -16,7 +16,7 @@ end
|
|
16
16
|
|
17
17
|
BUNDLE_FILE = "moneta-bundle-#{RUBY_VERSION}-#{ruby}.tar.gz"
|
18
18
|
|
19
|
-
if system("curl -f -u moneta:#{ENV['DAV_PW']} -k -o #{BUNDLE_FILE} https://
|
19
|
+
if system("curl -f -u moneta:#{ENV['DAV_PW']} -k -o #{BUNDLE_FILE} https://qxqx.de/dav/#{BUNDLE_FILE}")
|
20
20
|
cmd 'rm -rf .bundle'
|
21
21
|
cmd "tar -xpf #{BUNDLE_FILE}"
|
22
22
|
cmd "rm -f #{BUNDLE_FILE}"
|
data/script/install-kyotocabinet
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
|
3
|
-
if `wget --no-check-certificate --quiet -O kyotocabinet.tar.gz https://moneta:$DAV_PW@
|
3
|
+
if `wget --no-check-certificate --quiet -O kyotocabinet.tar.gz https://moneta:$DAV_PW@qxqx.de/dav/kyotocabinet.tar.gz`; then
|
4
4
|
tar -xf kyotocabinet.tar.gz
|
5
5
|
else
|
6
6
|
wget http://fallabs.com/kyotocabinet/pkg/kyotocabinet-1.2.76.tar.gz
|
@@ -11,7 +11,7 @@ else
|
|
11
11
|
make
|
12
12
|
cd ..
|
13
13
|
tar -czf kyotocabinet.tar.gz kyotocabinet-*
|
14
|
-
curl -u moneta:$DAV_PW -k -T kyotocabinet.tar.gz https://
|
14
|
+
curl -u moneta:$DAV_PW -k -T kyotocabinet.tar.gz https://qxqx.de/dav/ || echo 'Nothing uploaded'
|
15
15
|
fi
|
16
16
|
cd kyotocabinet-*
|
17
17
|
sudo make install
|
data/script/memusage
CHANGED
data/script/upload-bundle
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
#!/bin/bash
|
2
|
-
curl -f -u moneta:$DAV_PW -k -T moneta-bundle-*.tar.gz https://
|
2
|
+
curl -f -u moneta:$DAV_PW -k -T moneta-bundle-*.tar.gz https://qxqx.de/dav/ || echo 'Nothing uploaded'
|
@@ -20,11 +20,11 @@ class MonetaStoreTest < ActionDispatch::IntegrationTest
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def get_session_value
|
23
|
-
render :
|
23
|
+
render text: "foo: #{session[:foo].inspect}"
|
24
24
|
end
|
25
25
|
|
26
26
|
def get_session_id
|
27
|
-
render :
|
27
|
+
render text: "#{request.session_options[:id]}"
|
28
28
|
end
|
29
29
|
|
30
30
|
def call_reset_session
|
@@ -157,7 +157,7 @@ class MonetaStoreTest < ActionDispatch::IntegrationTest
|
|
157
157
|
|
158
158
|
reset!
|
159
159
|
|
160
|
-
get '/set_session_value', :
|
160
|
+
get '/set_session_value', _session_id: session_id
|
161
161
|
assert_response :success
|
162
162
|
assert_not_equal session_id, cookies['_session_id']
|
163
163
|
end
|
@@ -183,11 +183,11 @@ class MonetaStoreTest < ActionDispatch::IntegrationTest
|
|
183
183
|
def with_test_route_set
|
184
184
|
with_routing do |set|
|
185
185
|
set.draw do
|
186
|
-
get ':action', :
|
186
|
+
get ':action', to: ::MonetaStoreTest::TestController
|
187
187
|
end
|
188
188
|
|
189
189
|
@app = ActionDispatch::MiddlewareStack.new do |middleware|
|
190
|
-
middleware.use ActionDispatch::Session::MonetaStore, :
|
190
|
+
middleware.use ActionDispatch::Session::MonetaStore, key: '_session_id', store: :Memory
|
191
191
|
end.build(set)
|
192
192
|
|
193
193
|
yield
|
@@ -13,9 +13,9 @@ describe ActiveSupport::Cache::MonetaStore do
|
|
13
13
|
|
14
14
|
before(:each) do
|
15
15
|
@events.clear
|
16
|
-
@store = ActiveSupport::Cache::MonetaStore.new(:
|
17
|
-
@rabbit = OpenStruct.new :
|
18
|
-
@white_rabbit = OpenStruct.new :
|
16
|
+
@store = ActiveSupport::Cache::MonetaStore.new(store: Moneta.new(:Memory))
|
17
|
+
@rabbit = OpenStruct.new name: 'bunny'
|
18
|
+
@white_rabbit = OpenStruct.new color: 'white'
|
19
19
|
|
20
20
|
@store.write 'rabbit', @rabbit
|
21
21
|
@store.delete 'counter'
|
@@ -32,7 +32,7 @@ describe ActiveSupport::Cache::MonetaStore do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'writes the data with expiration time' do
|
35
|
-
@store.write 'rabbit', @white_rabbit, :
|
35
|
+
@store.write 'rabbit', @white_rabbit, expires_in: 1.second
|
36
36
|
@store.read('rabbit').should == @white_rabbit
|
37
37
|
sleep 2
|
38
38
|
@store.read('rabbit').should be_nil
|
@@ -53,8 +53,8 @@ describe ActiveSupport::Cache::MonetaStore do
|
|
53
53
|
@store.fetch('rub-a-dub').should be_nil
|
54
54
|
@store.fetch('rub-a-dub') { 'Flora de Cana' }
|
55
55
|
@store.fetch('rub-a-dub').should == 'Flora de Cana'
|
56
|
-
@store.fetch('rabbit', :
|
57
|
-
@store.fetch('rabbit', :
|
56
|
+
@store.fetch('rabbit', force: true) # force cache miss
|
57
|
+
@store.fetch('rabbit', force: true, expires_in: 1.second) { @white_rabbit }
|
58
58
|
@store.fetch('rabbit').should == @white_rabbit
|
59
59
|
sleep 2
|
60
60
|
@store.fetch('rabbit').should be_nil
|
@@ -76,24 +76,24 @@ describe ActiveSupport::Cache::MonetaStore do
|
|
76
76
|
|
77
77
|
it 'increments a key' do
|
78
78
|
3.times { @store.increment 'counter' }
|
79
|
-
@store.read('counter', :
|
79
|
+
@store.read('counter', raw: true).should == '3'
|
80
80
|
end
|
81
81
|
|
82
82
|
it 'decrements a key' do
|
83
83
|
3.times { @store.increment 'counter' }
|
84
84
|
2.times { @store.decrement 'counter' }
|
85
|
-
@store.read('counter', :
|
85
|
+
@store.read('counter', raw: true).should == '1'
|
86
86
|
end
|
87
87
|
|
88
88
|
it 'increments a key by given value' do
|
89
89
|
@store.increment 'counter', 3
|
90
|
-
@store.read('counter', :
|
90
|
+
@store.read('counter', raw: true).should == '3'
|
91
91
|
end
|
92
92
|
|
93
93
|
it 'decrements a key by given value' do
|
94
94
|
3.times { @store.increment 'counter' }
|
95
95
|
@store.decrement 'counter', 2
|
96
|
-
@store.read('counter', :
|
96
|
+
@store.read('counter', raw: true).should == '1'
|
97
97
|
end
|
98
98
|
|
99
99
|
describe 'notifications' do
|
@@ -105,13 +105,13 @@ describe ActiveSupport::Cache::MonetaStore do
|
|
105
105
|
read, generate, write = @events
|
106
106
|
|
107
107
|
read.name.should == 'cache_read.active_support'
|
108
|
-
read.payload.should == { :
|
108
|
+
read.payload.should == { key: 'radiohead', super_operation: :fetch }
|
109
109
|
|
110
110
|
generate.name.should == 'cache_generate.active_support'
|
111
|
-
generate.payload.should == { :
|
111
|
+
generate.payload.should == { key: 'radiohead' }
|
112
112
|
|
113
113
|
write.name.should == 'cache_write.active_support'
|
114
|
-
write.payload.should == { :
|
114
|
+
write.payload.should == { key: 'radiohead' }
|
115
115
|
end
|
116
116
|
|
117
117
|
it 'notifies on #read' do
|
@@ -121,7 +121,7 @@ describe ActiveSupport::Cache::MonetaStore do
|
|
121
121
|
|
122
122
|
read = @events.first
|
123
123
|
read.name.should == 'cache_read.active_support'
|
124
|
-
read.payload.should == { :
|
124
|
+
read.payload.should == { key: 'metallica', hit: false }
|
125
125
|
end
|
126
126
|
|
127
127
|
it 'notifies on #write' do
|
@@ -131,7 +131,7 @@ describe ActiveSupport::Cache::MonetaStore do
|
|
131
131
|
|
132
132
|
write = @events.first
|
133
133
|
write.name.should == 'cache_write.active_support'
|
134
|
-
write.payload.should == { :
|
134
|
+
write.payload.should == { key: 'depeche mode' }
|
135
135
|
end
|
136
136
|
|
137
137
|
it 'notifies on #delete' do
|
@@ -141,7 +141,7 @@ describe ActiveSupport::Cache::MonetaStore do
|
|
141
141
|
|
142
142
|
delete = @events.first
|
143
143
|
delete.name.should == 'cache_delete.active_support'
|
144
|
-
delete.payload.should == { :
|
144
|
+
delete.payload.should == { key: 'the new cardigans' }
|
145
145
|
end
|
146
146
|
|
147
147
|
it 'notifies on #exist?' do
|
@@ -151,7 +151,7 @@ describe ActiveSupport::Cache::MonetaStore do
|
|
151
151
|
|
152
152
|
exist = @events.first
|
153
153
|
exist.name.should == 'cache_exist?.active_support'
|
154
|
-
exist.payload.should == { :
|
154
|
+
exist.payload.should == { key: 'the smiths' }
|
155
155
|
end
|
156
156
|
|
157
157
|
it 'notifies on #increment' do
|
@@ -161,7 +161,7 @@ describe ActiveSupport::Cache::MonetaStore do
|
|
161
161
|
|
162
162
|
increment = @events.first
|
163
163
|
increment.name.should == 'cache_increment.active_support'
|
164
|
-
increment.payload.should == { :
|
164
|
+
increment.payload.should == { key: 'pearl jam', amount: 1 }
|
165
165
|
end
|
166
166
|
|
167
167
|
it 'notifies on #decrement' do
|
@@ -171,7 +171,7 @@ describe ActiveSupport::Cache::MonetaStore do
|
|
171
171
|
|
172
172
|
decrement = @events.first
|
173
173
|
decrement.name.should == 'cache_decrement.active_support'
|
174
|
-
decrement.payload.should == { :
|
174
|
+
decrement.payload.should == { key: 'placebo', amount: 1 }
|
175
175
|
end
|
176
176
|
|
177
177
|
it 'should notify on clear' do
|
@@ -181,7 +181,7 @@ describe ActiveSupport::Cache::MonetaStore do
|
|
181
181
|
|
182
182
|
clear = @events.first
|
183
183
|
clear.name.should == 'cache_clear.active_support'
|
184
|
-
clear.payload.should == { :
|
184
|
+
clear.payload.should == { key: nil }
|
185
185
|
end
|
186
186
|
end
|
187
187
|
|
@@ -4,13 +4,13 @@ require 'helper'
|
|
4
4
|
|
5
5
|
describe_moneta "adapter_activerecord_exisiting_connection" do
|
6
6
|
require 'active_record'
|
7
|
-
ActiveRecord::Base.establish_connection :
|
7
|
+
ActiveRecord::Base.establish_connection adapter: (defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql2'), database: 'moneta', username: 'root'
|
8
8
|
def features
|
9
9
|
[:create, :increment]
|
10
10
|
end
|
11
11
|
|
12
12
|
def new_store
|
13
|
-
Moneta::Adapters::ActiveRecord.new(:
|
13
|
+
Moneta::Adapters::ActiveRecord.new(table: 'adapter_activerecord_existing_connection')
|
14
14
|
end
|
15
15
|
|
16
16
|
def load_value(value)
|
@@ -8,7 +8,7 @@ describe_moneta "adapter_activerecord" do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def new_store
|
11
|
-
Moneta::Adapters::ActiveRecord.new(:
|
11
|
+
Moneta::Adapters::ActiveRecord.new(table: 'adapter_activerecord', connection: { adapter: (defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql2'), database: 'moneta', username: 'root' })
|
12
12
|
end
|
13
13
|
|
14
14
|
def load_value(value)
|
@@ -34,12 +34,12 @@ describe_moneta "adapter_activerecord" do
|
|
34
34
|
it 'updates an existing key/value' do
|
35
35
|
store['foo/bar'] = '1'
|
36
36
|
store['foo/bar'] = '2'
|
37
|
-
store.table.where(:
|
37
|
+
store.table.where(k: 'foo/bar').count.should == 1
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'supports different tables same database' do
|
41
|
-
store1 = Moneta::Adapters::ActiveRecord.new(:
|
42
|
-
store2 = Moneta::Adapters::ActiveRecord.new(:
|
41
|
+
store1 = Moneta::Adapters::ActiveRecord.new(table: 'adapter_activerecord1', connection: { adapter: (defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql2'), database: 'moneta', username: 'root' })
|
42
|
+
store2 = Moneta::Adapters::ActiveRecord.new(table: 'adapter_activerecord2', connection: { adapter: (defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql2'), database: 'moneta', username: 'root' })
|
43
43
|
|
44
44
|
store1['key'] = 'value1'
|
45
45
|
store2['key'] = 'value2'
|
@@ -51,8 +51,8 @@ describe_moneta "adapter_activerecord" do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'supports different databases same table' do
|
54
|
-
store1 = Moneta::Adapters::ActiveRecord.new(:
|
55
|
-
store2 = Moneta::Adapters::ActiveRecord.new(:
|
54
|
+
store1 = Moneta::Adapters::ActiveRecord.new(table: 'adapter_activerecord', connection: { adapter: (defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql2'), database: 'moneta_activerecord1', username: 'root' })
|
55
|
+
store2 = Moneta::Adapters::ActiveRecord.new(table: 'adapter_activerecord', connection: { adapter: (defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql2'), database: 'moneta_activerecord2', username: 'root' })
|
56
56
|
|
57
57
|
store1['key'] = 'value1'
|
58
58
|
store2['key'] = 'value2'
|
@@ -8,7 +8,7 @@ describe_moneta "adapter_cassandra_with_default_expires" do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def new_store
|
11
|
-
Moneta::Adapters::Cassandra.new(:
|
11
|
+
Moneta::Adapters::Cassandra.new(keyspace: 'adapter_cassandra_with_default_expires', expires: 1)
|
12
12
|
end
|
13
13
|
|
14
14
|
def load_value(value)
|
@@ -4,13 +4,13 @@ require 'helper'
|
|
4
4
|
|
5
5
|
describe_moneta "adapter_datamapper" do
|
6
6
|
require 'dm-core'
|
7
|
-
DataMapper.setup(:default, :
|
7
|
+
DataMapper.setup(:default, adapter: :in_memory)
|
8
8
|
def features
|
9
9
|
[:create]
|
10
10
|
end
|
11
11
|
|
12
12
|
def new_store
|
13
|
-
Moneta::Adapters::DataMapper.new(:
|
13
|
+
Moneta::Adapters::DataMapper.new(setup: "mysql://root:@localhost/moneta", table: "adapter_datamapper")
|
14
14
|
end
|
15
15
|
|
16
16
|
def load_value(value)
|
@@ -33,10 +33,10 @@ describe_moneta "adapter_datamapper" do
|
|
33
33
|
it_should_behave_like 'store_pathkey_stringvalue'
|
34
34
|
it_should_behave_like 'store_large'
|
35
35
|
it 'does not cross contaminate when storing' do
|
36
|
-
first = Moneta::Adapters::DataMapper.new(:
|
36
|
+
first = Moneta::Adapters::DataMapper.new(setup: "mysql://root:@localhost/moneta", table: "datamapper_first")
|
37
37
|
first.clear
|
38
38
|
|
39
|
-
second = Moneta::Adapters::DataMapper.new(:
|
39
|
+
second = Moneta::Adapters::DataMapper.new(repository: :sample, setup: "mysql://root:@localhost/moneta", table: "datamapper_second")
|
40
40
|
second.clear
|
41
41
|
|
42
42
|
first['key'] = 'value'
|
@@ -47,10 +47,10 @@ describe_moneta "adapter_datamapper" do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
it 'does not cross contaminate when deleting' do
|
50
|
-
first = Moneta::Adapters::DataMapper.new(:
|
50
|
+
first = Moneta::Adapters::DataMapper.new(setup: "mysql://root:@localhost/moneta", table: "datamapper_first")
|
51
51
|
first.clear
|
52
52
|
|
53
|
-
second = Moneta::Adapters::DataMapper.new(:
|
53
|
+
second = Moneta::Adapters::DataMapper.new(repository: :sample, setup: "mysql://root:@localhost/moneta", table: "datamapper_second")
|
54
54
|
second.clear
|
55
55
|
|
56
56
|
first['key'] = 'value'
|
@@ -8,7 +8,7 @@ describe_moneta "adapter_daybreak" do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def new_store
|
11
|
-
Moneta::Adapters::Daybreak.new(:
|
11
|
+
Moneta::Adapters::Daybreak.new(file: File.join(make_tempdir, "adapter_daybreak"))
|
12
12
|
end
|
13
13
|
|
14
14
|
def load_value(value)
|
@@ -10,10 +10,10 @@ describe_moneta "adapter_fog" do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def new_store
|
13
|
-
Moneta::Adapters::Fog.new(:
|
14
|
-
:
|
15
|
-
:
|
16
|
-
:
|
13
|
+
Moneta::Adapters::Fog.new(aws_access_key_id: 'fake_access_key_id',
|
14
|
+
aws_secret_access_key: 'fake_secret_access_key',
|
15
|
+
provider: 'AWS',
|
16
|
+
dir: 'adapter_fog')
|
17
17
|
end
|
18
18
|
|
19
19
|
def load_value(value)
|
@@ -8,7 +8,7 @@ describe_moneta "adapter_kyotocabinet" do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def new_store
|
11
|
-
Moneta::Adapters::KyotoCabinet.new(:
|
11
|
+
Moneta::Adapters::KyotoCabinet.new(file: File.join(make_tempdir, "adapter_kyotocabinet.kch"))
|
12
12
|
end
|
13
13
|
|
14
14
|
def load_value(value)
|
@@ -8,7 +8,7 @@ describe_moneta "adapter_lmdb_with_db" do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def new_store
|
11
|
-
Moneta::Adapters::LMDB.new(:
|
11
|
+
Moneta::Adapters::LMDB.new(dir: File.join(make_tempdir, "adapter_lmdb"), db: "adapter_lmdb_with_db")
|
12
12
|
end
|
13
13
|
|
14
14
|
def load_value(value)
|
@@ -8,7 +8,7 @@ describe_moneta "adapter_localmemcache" do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def new_store
|
11
|
-
Moneta::Adapters::LocalMemCache.new(:
|
11
|
+
Moneta::Adapters::LocalMemCache.new(file: File.join(make_tempdir, "adapter_localmemcache"))
|
12
12
|
end
|
13
13
|
|
14
14
|
def load_value(value)
|