redis-activesupport-with-cas 0.0.4 → 0.0.5

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: 959d6afec4261fe4517850052f7bdcb61ef409d1
4
- data.tar.gz: 51abad4cb3a8d037748c71ee3093f1be7faf8b90
3
+ metadata.gz: 51478907da551d80b99fd916ee09cfd4bd28ef1d
4
+ data.tar.gz: fc86d7e4e941850438d2c467d2aa054d63102d39
5
5
  SHA512:
6
- metadata.gz: fd1bd9ab51df30aec6519441ccda337b078581622256932665170ad720cb69401bc1d57870cb568f95d4f13497c5b3ef4b88dd300f206e495820f98d00e2da67
7
- data.tar.gz: d3fce630d16efd33df097de981cd3fa353ca847bf075a17766e9eeb605f4b6b92b03ebc5a7a1beb5a44c4189704a0af1fa0d67a85d38adb8ae0c917e159f2db4
6
+ metadata.gz: e602c8bb53052b03f784b1a558cd2ea5bb4429acdee26ecd5478adbc63bcff11ec501992cec3a171dc2287185313851d44b252ebfe8ff0a917ffe10fd331e0b5
7
+ data.tar.gz: 7ffa3ba6aaa11d394d90417b04834b62398a5d5bb8cdd6ba5cedb2edee9550b77e9a5f0b259bc1e5f8f51054652a09c74729d90280dca588a58207ce93eb2d0f
@@ -13,10 +13,12 @@ module ActiveSupport
13
13
  key = normalize_key(name, options)
14
14
  instrument(:cas, name, options) do
15
15
  ttl = cas_expiration options
16
- @data.cas(key,ttl) do |entry|
17
- value = yield entry.value
18
- break true if read_only
19
- options[:raw].present? ? value : Entry.new(value, options)
16
+ with do |c|
17
+ c.cas(key,ttl) do |entry|
18
+ value = yield entry.value
19
+ break true if read_only
20
+ options[:raw].present? ? value : Entry.new(value, options)
21
+ end
20
22
  end
21
23
  end
22
24
  end
@@ -29,17 +31,19 @@ module ActiveSupport
29
31
  keys_to_names = Hash[names.map { |name| [normalize_key(name, options), name] }]
30
32
 
31
33
  instrument(:cas_multi, names, options) do
32
- @data.cas_multi(*(keys_to_names.keys), {:expires_in => cas_expiration(options)}) do |raw_values|
33
- values = {}
34
- raw_values.each do |key, entry|
35
- values[keys_to_names[key]] = entry.value unless entry.expired?
36
- end
37
- values = yield values
38
- break true if read_only
39
- mapped_values = values.map do |name,value|
40
- [normalize_key(name, options),options[:raw].present? ? value : Entry.new(value, options)]
34
+ with do |c|
35
+ c.cas_multi(*(keys_to_names.keys), {:expires_in => cas_expiration(options)}) do |raw_values|
36
+ values = {}
37
+ raw_values.each do |key, entry|
38
+ values[keys_to_names[key]] = entry.value unless entry.expired?
39
+ end
40
+ values = yield values
41
+ break true if read_only
42
+ mapped_values = values.map do |name,value|
43
+ [normalize_key(name, options),options[:raw].present? ? value : Entry.new(value, options)]
44
+ end
45
+ Hash[mapped_values]
41
46
  end
42
- Hash[mapped_values]
43
47
  end
44
48
  true
45
49
  end
@@ -3,7 +3,7 @@ $:.push File.expand_path('../lib', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'redis-activesupport-with-cas'
6
- s.version = '0.0.4'
6
+ s.version = '0.0.5'
7
7
  s.authors = ['Rajko Albrecht']
8
8
  s.email = ['ral@alwins-world.de']
9
9
  s.homepage = 'https://git.alwin-it.de/alwin/redis-activesupport-with-cas'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-activesupport-with-cas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rajko Albrecht
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-05 00:00:00.000000000 Z
11
+ date: 2018-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis