double_write_cache_stores 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7f7fdc6dba1ecd41eb133c8ec2472af02c52de3b
4
- data.tar.gz: 891476fd39e78e0003241cb7c31dca6ec46ad9f3
3
+ metadata.gz: f46540045c69ebc0ff51716382878b96dd606845
4
+ data.tar.gz: 158b14cf333f3915e641298634f858bedd2de184
5
5
  SHA512:
6
- metadata.gz: 05cb7eb7faeee0ec6efc0d15e8c1be8d25d2bd7916280c598e82e1834ee80e2f32a235033997875aea81e09f4c188d999c656e97b914a86e92a58656c0065cef
7
- data.tar.gz: cff835f626c32b768c616c445f6e52ec65cbcc54e5ca515a589afe2cb570e9df2de49062e3bc70cf6c1ad802e211af39abf46a052af60a8e9e966ae302f80947
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
- ## Support
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
@@ -1,3 +1,3 @@
1
1
  module DoubleWriteCacheStores
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  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 be_true
65
- expect(support_touch_copy_cache_store.touch 'non-set-key').to be_nil
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 be_false
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 be_true
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.2
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-05-16 00:00:00.000000000 Z
11
+ date: 2014-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler