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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6f9dcec4358e48e8b6b18ad80805ce0b6cab0c54
4
- data.tar.gz: ed599e724c3fd0e3edaee0d94346bc864340b480
3
+ metadata.gz: ac2bc2fd54f0bcbf716717041bb04abe85450a75
4
+ data.tar.gz: 3470a817a32446a442f2fddbdd47b41de5afe485
5
5
  SHA512:
6
- metadata.gz: 7ae70e5790a83ecab1f91148ddce344514c30fcf8e067f8961c777d07e678cbbc505d5ac7385df3f297a609bd6b037af9c394b7b29c5cb87ae7e72233262dd59
7
- data.tar.gz: 68236e9cfa44f3a159bd8daad5cf269e5a19b0ae0f1665be2af59ca854932f76042530b9d9c6e8468c36d2b12c9ce8e807d483fa2b0cc6d4736e377f8ce60790
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
@@ -1,3 +1,3 @@
1
1
  module CacheUtils
2
- VERSION = '0.2.4'.freeze
2
+ VERSION = '0.2.5'.freeze
3
3
  end
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
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-07-27 00:00:00.000000000 Z
11
+ date: 2017-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler