model-cache 0.1.2 → 0.1.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.
Files changed (2) hide show
  1. data/lib/model_cache.rb +4 -4
  2. metadata +1 -1
@@ -1,7 +1,7 @@
1
1
  module ModelCache
2
2
 
3
- DEFAULT_TIME = 12.hours
4
- @@nil_object ||= Object.new
3
+ DEFAULT_TIME = 12.hours unless const_defined?(:DEFAULT_TIME)
4
+ NIL_OBJECT = Object.new unless const_defined?(:NIL_OBJECT)
5
5
 
6
6
  def self.included(klass)
7
7
  klass.extend ClassMethods
@@ -13,7 +13,7 @@ module ModelCache
13
13
 
14
14
  def self.cache(ckey, time = DEFAULT_TIME, &block)
15
15
  if Rails.configuration.action_controller.perform_caching && (result = CACHE.get(ckey))
16
- if result == @@nil_object
16
+ if result == NIL_OBJECT
17
17
  nil
18
18
  else
19
19
  result
@@ -24,7 +24,7 @@ module ModelCache
24
24
  if result
25
25
  CACHE.set(ckey, result, time)
26
26
  else
27
- CACHE.set(ckey, @@nil_object, time)
27
+ CACHE.set(ckey, NIL_OBJECT, time)
28
28
  end
29
29
  end
30
30
  result
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: model-cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frantisek Havluj