cache_utils 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cache_utils/controller.rb +14 -0
- data/lib/cache_utils/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac2bc2fd54f0bcbf716717041bb04abe85450a75
|
4
|
+
data.tar.gz: 3470a817a32446a442f2fddbdd47b41de5afe485
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2ce47c515689c4ab832863077d0be742e336f00f9844683b1cd4de7e62a20e5b7237583710867e185e88634443bb58fc602d723a5fd4a762501b49b2b240fb2
|
7
|
+
data.tar.gz: f93d76a4d9be66f0d61c45ecae56947af380f35dc3a30b0200eff12e1f7b625a91af0cfbc2e6650309b40348c843f51130ea9d877d6d13d4069bfc0bbc944fc5
|
@@ -24,6 +24,20 @@ module CacheUtils
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
+
def get_cache(key)
|
28
|
+
cached = $redis.get(key)
|
29
|
+
if cached
|
30
|
+
Appsignal.increment_counter('cache_hit', 1) if defined?(Appsignal)
|
31
|
+
return cached
|
32
|
+
end
|
33
|
+
Appsignal.increment_counter('cache_miss', 1) if defined?(Appsignal)
|
34
|
+
nil
|
35
|
+
end
|
36
|
+
|
37
|
+
def set_cache(key, content)
|
38
|
+
$redis.set(key, content)
|
39
|
+
end
|
40
|
+
|
27
41
|
def fetch_cache(key, _options = nil)
|
28
42
|
cached = $redis.get(key)
|
29
43
|
if cached
|
data/lib/cache_utils/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cache_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michele Finotto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|