double_write_cache_stores 0.0.3 → 0.0.4

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: f46540045c69ebc0ff51716382878b96dd606845
4
- data.tar.gz: 158b14cf333f3915e641298634f858bedd2de184
3
+ metadata.gz: 8d14a5f53f7caef579a423332dffc1a8973abfe1
4
+ data.tar.gz: 5202dc0ccb089fe2a0dde67d60b18d2e1a527128
5
5
  SHA512:
6
- metadata.gz: dc57efcf2a05d94b3c1b71e7ac71d3a9aad265df9d1d2de2a9be72361a956232d3d43f4f5ee2e9fa98419b7ddd4955545c1f9e3afa2ab9cc26eb823f49020a6f
7
- data.tar.gz: 249b72dd7a1645bb493a3881efaec500955161e7d1f1fc29517814bd95377f692bce626147c87645d6dad6c48b5b002eb353c72f0f86f158641f3a5b1ceaf7c9
6
+ metadata.gz: b35d929dfac751e60978469507519524f0848d26fc9cf3f5dc59b0f4edc5ca28de4c02be98947d304f4ebedc80f2d621d3801ef8e0706da5cce3bf8f7ae90b14
7
+ data.tar.gz: 9803d72741ebff1ae00e9b347ef52d9ab96f60c70ce599e52b2bdeca83bbe182235fa519423d3c284b30d2e601d35c0afd1003571b8da10aa76ccb4c0395cdd2
@@ -40,7 +40,7 @@ class DoubleWriteCacheStores::Client
40
40
 
41
41
  def touch(key)
42
42
  result = false
43
- read_and_write_backend = @read_and_write_store.instance_variable_get '@backend'
43
+ read_and_write_backend = @read_and_write_store.instance_variable_get('@backend') || @read_and_write_store.instance_variable_get('@data')
44
44
  if read_and_write_backend && read_and_write_backend.respond_to?(:touch)
45
45
  result = read_and_write_backend.touch key
46
46
  write_only_store_touch key
@@ -92,7 +92,8 @@ class DoubleWriteCacheStores::Client
92
92
 
93
93
  def write_only_store_touch(key)
94
94
  if @write_only_store
95
- if write_only_backend = @write_only_store.instance_variable_get('@backend')
95
+ write_only_backend = @write_only_store.instance_variable_get('@backend') || @write_only_store.instance_variable_get('@data')
96
+ if write_only_backend
96
97
  write_only_backend.touch key if write_only_backend.respond_to?(:touch)
97
98
  end
98
99
  end
@@ -1,3 +1,3 @@
1
1
  module DoubleWriteCacheStores
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -67,16 +67,26 @@ describe DoubleWriteCacheStores::Client do
67
67
  before do
68
68
  support_touch_copy_cache_store.set 'touch-key', 'touch-value', :expires_in => 1.day
69
69
  end
70
- it 'example' do
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
70
+
71
+ context 'Dalli::Client' do
72
+ it 'example' do
73
+ expect(support_touch_copy_cache_store.touch 'touch-key').to be true
74
+ expect(support_touch_copy_cache_store.touch 'non-set-key').to be nil
75
+ end
73
76
  end
74
- context 'when touch non support backend' do
77
+
78
+ context 'ActiveSupport::Cache::DalliStore' do
79
+ let :double_write_dalli_store do
80
+ DoubleWriteCacheStores::Client.new ActiveSupport::Cache::DalliStore.new('localhost:11211', options), ActiveSupport::Cache::DalliStore.new('localhost:21211', options)
81
+ end
82
+
75
83
  before do
76
- copy_cache_store.write 'unsupport-touch-key', 'touch-value', :expires_in => 1.day
84
+ double_write_dalli_store.set 'touch-key', 'touch-valule', :expires_in => 1.day
77
85
  end
78
- it 'not doing touch' do
79
- expect(copy_cache_store.touch 'unsupport-touch-key').to be false
86
+
87
+ it 'example' do
88
+ expect(double_write_dalli_store.touch 'touch-key').to be true
89
+ expect(double_write_dalli_store.touch 'non-set-key').to be nil
80
90
  end
81
91
  end
82
92
  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.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - hirocaster
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-18 00:00:00.000000000 Z
11
+ date: 2014-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler