dalli-store-with-cas 0.0.1 → 0.0.2

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: a6e6ae334ee9219c881b980ae5126911c0c10aeb
4
- data.tar.gz: 664db479eeb84b8178c497ad4ebd050455e8840c
3
+ metadata.gz: 95d123577ec7ed1f1772d433519a7f820dfcbd61
4
+ data.tar.gz: 4c1921041a203af90a81acc92b167761df08da56
5
5
  SHA512:
6
- metadata.gz: c59bbdd570f905370b677393d863a33ec96bb72851f7d5d20584214411713caabf8ca6cac640d2b5cf89120202e7d69c8f8d63662cc0d5d2b614c9884f72b3e9
7
- data.tar.gz: '0582e569732cdac98966a92ea0b61b854bdbf0ae01dd1f6a645c03cd03f9e983435aac7b88b05aeb61a5300c9b876175a2531a2d8f168bc30249f036babb405a'
6
+ metadata.gz: ab8e9c64d4998fdb44cbf46b488a9a24a9cbc18c4731a62b9b19089e6c3294f78c8549b9e1e47f456a6b7cfefc7f6251f6af482210a0bc909f18e0d078570e8c
7
+ data.tar.gz: bb538ca70d1b096ff9ddf5f82e381fb7a9970b20ad7158de16761437b19814ae715c806af13acd4fe6090cd8442e4ac8ca598299f358997d0967e3bbda34c72e
@@ -4,7 +4,7 @@ require 'dalli/cas/client'
4
4
  module ActiveSupport
5
5
  module Cache
6
6
  class DalliStoreWithCas < DalliStore
7
- DALLI_STORE_WITH_CAS_VERSION = "0.0.1"
7
+ DALLI_STORE_WITH_CAS_VERSION = "0.0.2"
8
8
 
9
9
  def cas(name, options = {})
10
10
  cas_multi(name, options) { |kv| { kv.keys.first => yield(kv.values.first) } }
@@ -19,26 +19,30 @@ module ActiveSupport
19
19
  with do |c|
20
20
  keys_to_value_and_cas = c.get_multi_cas(keys_to_names.keys)
21
21
 
22
- values_to_yield = keys_to_value_and_cas.map do |key, value_and_cas|
23
- [key, value_and_cas.first]
24
- end.to_h
25
- new_values = yield values_to_yield
26
-
27
- successfully_updated_values = {}
28
- found_corresponding_key = false
29
-
30
- new_values.each do |k, v|
31
- value_and_cas = keys_to_value_and_cas[k]
32
- if value_and_cas
33
- found_corresponding_key = true
34
- current_cas = value_and_cas.last
35
- if c.set_cas(k, v, current_cas, nil, options)
36
- successfully_updated_values[k] = v
22
+ if keys_to_value_and_cas.present?
23
+ values_to_yield = keys_to_value_and_cas.map do |key, value_and_cas|
24
+ [key, value_and_cas.first]
25
+ end.to_h
26
+ new_values = yield values_to_yield
27
+
28
+ successfully_updated_values = {}
29
+ found_corresponding_key = false
30
+
31
+ new_values.each do |k, v|
32
+ value_and_cas = keys_to_value_and_cas[k]
33
+ if value_and_cas
34
+ found_corresponding_key = true
35
+ current_cas = value_and_cas.last
36
+ if c.set_cas(k, v, current_cas, nil, options)
37
+ successfully_updated_values[k] = v
38
+ end
37
39
  end
38
40
  end
39
- end
40
41
 
41
- !found_corresponding_key || successfully_updated_values.present?
42
+ !found_corresponding_key || successfully_updated_values.present?
43
+ else
44
+ true
45
+ end
42
46
  end
43
47
  end
44
48
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dalli-store-with-cas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Misha Conway