double_write_cache_stores 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f46540045c69ebc0ff51716382878b96dd606845
|
4
|
+
data.tar.gz: 158b14cf333f3915e641298634f858bedd2de184
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc57efcf2a05d94b3c1b71e7ac71d3a9aad265df9d1d2de2a9be72361a956232d3d43f4f5ee2e9fa98419b7ddd4955545c1f9e3afa2ab9cc26eb823f49020a6f
|
7
|
+
data.tar.gz: 249b72dd7a1645bb493a3881efaec500955161e7d1f1fc29517814bd95377f692bce626147c87645d6dad6c48b5b002eb353c72f0f86f158641f3a5b1ceaf7c9
|
data/README.md
CHANGED
@@ -2,7 +2,13 @@
|
|
2
2
|
|
3
3
|
pre-warning(double write to cach store and other cache store) cache store wrapper. will switch cache store.
|
4
4
|
|
5
|
-
##
|
5
|
+
## Convertible interface, get/set by cache store
|
6
|
+
|
7
|
+
- Padrino::Cache(moneta)
|
8
|
+
- ActiveSupport::Cache::DalliStore(Dalli)
|
9
|
+
- Padrino::Cache::Store::Memcache
|
10
|
+
|
11
|
+
## Support backend cache store
|
6
12
|
|
7
13
|
- ActiveSupport::Cache::DalliStore(Dalli)
|
8
14
|
- Padrino::Cache::Store::Memcache
|
@@ -9,6 +9,10 @@ class DoubleWriteCacheStores::Client
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
+
def [](key)
|
13
|
+
get key
|
14
|
+
end
|
15
|
+
|
12
16
|
def get(key)
|
13
17
|
get_or_read_method_call key
|
14
18
|
end
|
@@ -22,6 +26,10 @@ class DoubleWriteCacheStores::Client
|
|
22
26
|
@write_only_store.delete key if @write_only_store
|
23
27
|
end
|
24
28
|
|
29
|
+
def []=(key, value)
|
30
|
+
set key, value
|
31
|
+
end
|
32
|
+
|
25
33
|
def set(key, value, options = nil)
|
26
34
|
write_cache_store key, value, options
|
27
35
|
end
|
@@ -29,6 +29,13 @@ describe DoubleWriteCacheStores::Client do
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
+
describe 'set #[]=(key, value) and get #[](key)' do
|
33
|
+
it 'set value and get value' do
|
34
|
+
copy_cache_store['key'] = 'example-value'
|
35
|
+
expect(copy_cache_store['key']).to eq 'example-value'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
32
39
|
describe '#delete' do
|
33
40
|
before do
|
34
41
|
copy_cache_store.write 'will-delete-key', 'example-will-delete-value', :expires_in => 1.day
|
@@ -61,15 +68,15 @@ describe DoubleWriteCacheStores::Client do
|
|
61
68
|
support_touch_copy_cache_store.set 'touch-key', 'touch-value', :expires_in => 1.day
|
62
69
|
end
|
63
70
|
it 'example' do
|
64
|
-
expect(support_touch_copy_cache_store.touch 'touch-key').to
|
65
|
-
expect(support_touch_copy_cache_store.touch 'non-set-key').to
|
71
|
+
expect(support_touch_copy_cache_store.touch 'touch-key').to be true
|
72
|
+
expect(support_touch_copy_cache_store.touch 'non-set-key').to be nil
|
66
73
|
end
|
67
74
|
context 'when touch non support backend' do
|
68
75
|
before do
|
69
76
|
copy_cache_store.write 'unsupport-touch-key', 'touch-value', :expires_in => 1.day
|
70
77
|
end
|
71
78
|
it 'not doing touch' do
|
72
|
-
expect(copy_cache_store.touch 'unsupport-touch-key').to
|
79
|
+
expect(copy_cache_store.touch 'unsupport-touch-key').to be false
|
73
80
|
end
|
74
81
|
end
|
75
82
|
end
|
@@ -128,7 +135,7 @@ describe DoubleWriteCacheStores::Client do
|
|
128
135
|
end
|
129
136
|
it 'example' do
|
130
137
|
expect(support_flash_copy_cache_store.get 'will-flush-key').to eq 'will-flush-value'
|
131
|
-
expect(support_flash_copy_cache_store.flush).to
|
138
|
+
expect(support_flash_copy_cache_store.flush).to be true
|
132
139
|
expect(support_flash_copy_cache_store.get 'will-flush-key').to be_nil
|
133
140
|
end
|
134
141
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: double_write_cache_stores
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hirocaster
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|