dalli-store-with-cas 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 +4 -4
- data/lib/active_support/cache/dalli_store_with_cas.rb +11 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c90a7113c8745572f38d25a7186104e7ad9ba45
|
4
|
+
data.tar.gz: 7c675fc318f2da8f868de22d76e5ee149128478c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe63dae8f1cbc7c40a2645c6611bc3b52a9e627510aaad65725d3c6cab8783243d73edefa8ff301d2f41f668bb20300275df7a00ff0aa617f792c1f4b370385c
|
7
|
+
data.tar.gz: 69c651e48a9d18d354ad4d5011864459f7497e8d6343a3c2df322b5e33f467e02194cd68d44dec6718a78424d1c4c2fcd46caf1d51dc5902ad286e582dac9881
|
@@ -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.
|
7
|
+
DALLI_STORE_WITH_CAS_VERSION = "0.0.3"
|
8
8
|
|
9
9
|
def cas(name, options = {})
|
10
10
|
cas_multi(name, options) { |kv| { kv.keys.first => yield(kv.values.first) } }
|
@@ -13,11 +13,18 @@ module ActiveSupport
|
|
13
13
|
def cas_multi(*names, **options)
|
14
14
|
return if names.empty?
|
15
15
|
|
16
|
-
|
16
|
+
namespaced_keys = names.map{|name| namespaced_key(name, options )}
|
17
|
+
using_single_cas = 1 == namespaced_keys.size
|
17
18
|
|
18
|
-
|
19
|
+
|
20
|
+
instrument_with_log((using_single_cas ? :cas : :cas_multi), names, options) do
|
19
21
|
with do |c|
|
20
|
-
keys_to_value_and_cas =
|
22
|
+
keys_to_value_and_cas = if using_single_cas
|
23
|
+
key_value, key_cas = c.get_cas(*namespaced_keys)
|
24
|
+
{namespaced_keys.first => [key_value, key_cas]} if key_value
|
25
|
+
else
|
26
|
+
c.get_multi_cas(*namespaced_keys)
|
27
|
+
end
|
21
28
|
|
22
29
|
if keys_to_value_and_cas.present?
|
23
30
|
values_to_yield = keys_to_value_and_cas.map do |key, value_and_cas|
|