h2ocube_rails_cache 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/h2ocube_rails_cache.gemspec +1 -1
- data/lib/active_support/cache/h2ocube_rails_cache.rb +20 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aeb85c3d49fde5bb5ed13dea42a264e1c6aac05cffa0e42bf8738f22731792f5
|
4
|
+
data.tar.gz: 8b04a9d15740a8b617468019278d96734fd43c87276e92d98fb33e3d8a4d1fca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c2bc8655b53395613b183019858d6dc61b8776cc0328cd0bd250c0a5cf75c322f0d33fdc6e671cf8118c85634ab2f3a0a02044b409dd9933f34200a972b414d
|
7
|
+
data.tar.gz: 8e9511aba23192c112cdc955eb1ade7ad30de44a40729011905f3ef551075a6c3f42b7f045ba333e472185540bde71ba8e2c28adda00b922bd582dcbe3b6546a
|
data/README.md
CHANGED
data/h2ocube_rails_cache.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.name = 'h2ocube_rails_cache'
|
7
|
-
gem.version = '0.3.
|
7
|
+
gem.version = '0.3.1'
|
8
8
|
gem.authors = ['Ben']
|
9
9
|
gem.email = ['ben@h2ocube.com']
|
10
10
|
gem.description = 'Just an redis cache.'
|
@@ -53,7 +53,7 @@ module ActiveSupport
|
|
53
53
|
key = normalize_key key
|
54
54
|
return nil if key.start_with?('http')
|
55
55
|
instrument :read, key, options do
|
56
|
-
|
56
|
+
load_entry @data.get(key)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -64,15 +64,15 @@ module ActiveSupport
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def read_multi(*names)
|
67
|
-
|
67
|
+
keys = names.map { |name| normalize_key(name) }
|
68
|
+
values = @data.mget(*keys)
|
68
69
|
|
69
|
-
names.
|
70
|
-
|
71
|
-
|
72
|
-
|
70
|
+
names.zip(values).each_with_object({}) do |(name, value), results|
|
71
|
+
if value
|
72
|
+
entry = load_entry(value)
|
73
|
+
results[name] = entry.value unless entry.nil?
|
74
|
+
end
|
73
75
|
end
|
74
|
-
|
75
|
-
results
|
76
76
|
end
|
77
77
|
|
78
78
|
def write(key, entry, opts = {})
|
@@ -99,6 +99,16 @@ module ActiveSupport
|
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
|
+
def write_multi(hash)
|
103
|
+
instrument :write_multi, hash do
|
104
|
+
entries = hash.each_with_object({}) do |(name, value), memo|
|
105
|
+
memo[normalize_key(name)] = dump_entry value
|
106
|
+
end
|
107
|
+
|
108
|
+
@data.mapped_mset entries
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
102
112
|
def delete(key, options = {})
|
103
113
|
options.reverse_merge! config
|
104
114
|
key = normalize_key key
|
@@ -202,6 +212,8 @@ module ActiveSupport
|
|
202
212
|
end
|
203
213
|
|
204
214
|
def load_entry(entry)
|
215
|
+
return nil if entry.nil?
|
216
|
+
|
205
217
|
begin
|
206
218
|
Marshal.load(entry)
|
207
219
|
rescue
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: h2ocube_rails_cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|