sequel_acts_as_cacheable 1.2 → 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.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YmU4OGExMWI4ODRiMWYzODNhYTBmZTUzNDE5MDY0NjI1MDEwZTY4Zg==
5
- data.tar.gz: !binary |-
6
- ZDFhYmNkZDYxM2EzYWZhMDgxZTAwMDFlZTNhZjk0MDBiZTc0YzA4OA==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- ZjBlNzY3MDUzYTM4ZWMzMDFmNTM5NGU5MzQ2ODQ3ZjUxMzYyMWRkNjk5Nzc5
10
- NGE1ZDNkMzk4ZTU1ODM1MzNhNDVlYWIwYmVjODVmOTMwZDZhNzgzMjkxMGY1
11
- ZWFmYzMyODMwZmQzOGQ2M2NmODc5ZmFhZGE3MWM3YmRkNGRhMWQ=
12
- data.tar.gz: !binary |-
13
- YjQ0ODMyNDM5OTc0Y2EwOTcyZjAzOWM2MjU0MjkyNTI4ZmFkMTZjZjVjZTRi
14
- YTMzY2VlYTQ5ZGQ2MGJjMjZjNjM1MzgyZGJjYjdmZTg1ZDFmMjc1ZDRjMjhl
15
- NjZkYmNiYTJlOTNiMTZkZTBmMTg4OWUxM2YyZTIyZmRlM2YyMWU=
2
+ SHA1:
3
+ metadata.gz: 53d6ea8a264d47a76246e7e97294fb2197aefb8e
4
+ data.tar.gz: 50af6d2226fb7259a07e97a128c7d919248498bf
5
+ SHA512:
6
+ metadata.gz: a011d119fd654ea206f3d8e9d72c681a74172062ec8e674085c53f6f168818b12db5fde77eedaec27f6f76716cf34010ccc3c07da2a8f2d02f260bee722ca42d
7
+ data.tar.gz: c39312517e4f21e93f890e25f53182737724062057bb710289200d55675e0b17fe3a1280d3edaec07b5e1698e6b6813a588861892aca5acded894786db7ac6d6
@@ -5,18 +5,21 @@ module Sequel
5
5
  model.instance_eval do
6
6
  @acts_as_cacheable_cache = opts[:cache]
7
7
  @acts_as_cacheable_time_to_live = opts[:time_to_live] || 3600
8
+ @acts_as_cacheable_logger = opts[:logger]
8
9
  end
9
10
  end
10
11
 
11
12
  module ClassMethods
12
13
  attr_accessor :acts_as_cacheable_cache
13
14
  attr_accessor :acts_as_cacheable_time_to_live
15
+ attr_accessor :acts_as_cacheable_logger
14
16
 
15
17
  # Copy the necessary class instance variables to the subclass.
16
18
  def inherited(subclass)
17
19
  super
18
20
  subclass.acts_as_cacheable_cache = acts_as_cacheable_cache
19
21
  subclass.acts_as_cacheable_time_to_live = acts_as_cacheable_time_to_live
22
+ subclass.acts_as_cacheable_logger = acts_as_cacheable_logger
20
23
  end
21
24
 
22
25
  def model_cache_key model_id
@@ -51,7 +54,9 @@ module Sequel
51
54
  begin
52
55
  cache_value = @acts_as_cacheable_cache.get key
53
56
  rescue Exception => e
54
- logger.error "CACHE.get failed in primary key lookup with args #{args.inspect} and model #{self.class.name} so using mysql lookup instead, exception was #{e.inspect}"
57
+ if acts_as_cacheable_logger
58
+ acts_as_cacheable_logger.error "CACHE.get failed in primary key lookup with args #{args.inspect} and model #{self.class.name} so using mysql lookup instead, exception was #{e.inspect}"
59
+ end
55
60
  cache_value = super *args
56
61
  end
57
62
 
@@ -102,7 +107,9 @@ module Sequel
102
107
  begin
103
108
  result = super
104
109
  rescue Sequel::NoExistingObject
105
- logger.error "attempted to delete a record that doesn't exist"
110
+ if acts_as_cacheable_logger
111
+ acts_as_cacheable_logger.error "attempted to delete a record that doesn't exist"
112
+ end
106
113
  end
107
114
  invalidate_cache!
108
115
  result
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel_acts_as_cacheable
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.2'
4
+ version: '1.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Misha Conway
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-22 00:00:00.000000000 Z
11
+ date: 2014-02-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: MishaAConway@gmail.com
@@ -27,17 +27,17 @@ require_paths:
27
27
  - lib
28
28
  required_ruby_version: !ruby/object:Gem::Requirement
29
29
  requirements:
30
- - - ! '>='
30
+ - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: '0'
33
33
  required_rubygems_version: !ruby/object:Gem::Requirement
34
34
  requirements:
35
- - - ! '>='
35
+ - - ">="
36
36
  - !ruby/object:Gem::Version
37
37
  version: '0'
38
38
  requirements: []
39
39
  rubyforge_project: nowarning
40
- rubygems_version: 2.0.3
40
+ rubygems_version: 2.2.1
41
41
  signing_key:
42
42
  specification_version: 4
43
43
  summary: Memcaching for sequel models.