incrdecr_cached_counts 0.0.5 → 0.0.6

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: d751a2be8fc971ab8346677cf6af2417bd24c484
4
- data.tar.gz: b05d9811217b500bc3e28fd15d0719837833c9cc
3
+ metadata.gz: a018b5815304845fe6bd35505944da125418b3e5
4
+ data.tar.gz: c1799c3ddaa64683faf943ea9e0d352177c896f0
5
5
  SHA512:
6
- metadata.gz: 1f42924de3ffae5cebb7c496a95a486a283126852c3d0c0a9239b158204aa38ba0191d8569b26266466f50f8ae200344ae4ab4e59db0c33b7b598bf80f1176a8
7
- data.tar.gz: cf742a3a18c544245972b41e7187ab5d1f82374bc8d664387cbdf196e12447978f9e0aebb273849a73c0b0e011bb90936f55b57ad0773254ee75add302e8dd93
6
+ metadata.gz: d4ae781d8e7394523beb4f91cbb622f018bc9ee30a04a92cbd4e00e7bdecbeb87f93c9f87dacc6b27a41872c1b1b64f97349a4ecfb1a89043345922a8f57b699
7
+ data.tar.gz: d52e2154bc2bd201b8297b9ca32cd4b142f1a265e2f7f89b8df3b86aa4c0b8ccd79ecf76e847da13c0f86389ca017ef465ae501d330a22653fb13521e73e1862
@@ -0,0 +1,12 @@
1
+ module CachedCounts
2
+ def self.logger
3
+ @logger ||= begin
4
+ if Rails.logger.nil?
5
+ require 'logger'
6
+ Logger.new($stderr)
7
+ else
8
+ Rails.logger
9
+ end
10
+ end
11
+ end
12
+ end
@@ -1,3 +1,3 @@
1
1
  module CachedCounts
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/lib/cached_counts.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'cached_counts/logger'
1
2
  require 'cached_counts/dalli_check'
2
3
  require 'cached_counts/connection_for'
3
4
 
@@ -241,7 +242,7 @@ module CachedCounts
241
242
  # Ensure that other reads find something in the cache, but
242
243
  # continue calculating here because the default is likely inaccurate.
243
244
  fallback_value = instance_exec &race_condition_fallback
244
- logger.warn "Setting #{fallback_value} as race_condition_fallback for #{send(key_method)}"
245
+ CachedCounts.logger.warn "Setting #{fallback_value} as race_condition_fallback for #{send(key_method)}"
245
246
  Rails.cache.write(
246
247
  send(key_method),
247
248
  fallback_value.to_i,
@@ -397,16 +398,6 @@ module CachedCounts
397
398
  end
398
399
  end
399
400
 
400
- def logger
401
- @logger ||= begin
402
- if Rails.logger.nil?
403
- require 'logger'
404
- Logger.new($stderr)
405
- else
406
- Rails.logger
407
- end
408
- end
409
- end
410
401
  end
411
402
  end
412
403
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: incrdecr_cached_counts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Judd
@@ -143,6 +143,7 @@ files:
143
143
  - lib/cached_counts.rb
144
144
  - lib/cached_counts/connection_for.rb
145
145
  - lib/cached_counts/dalli_check.rb
146
+ - lib/cached_counts/logger.rb
146
147
  - lib/cached_counts/railtie.rb
147
148
  - lib/cached_counts/version.rb
148
149
  - spec/caches_count_of_spec.rb