cache_advance 1.1.4 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.4
1
+ 1.1.5
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{cache_advance}
8
- s.version = "1.1.4"
8
+ s.version = "1.1.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Aubrey Holland"]
12
- s.date = %q{2009-10-21}
12
+ s.date = %q{2010-03-01}
13
13
  s.description = %q{hmm}
14
14
  s.email = %q{aubreyholland@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -44,7 +44,7 @@ Gem::Specification.new do |s|
44
44
  s.homepage = %q{http://github.com/aub/cache_advance/tree/master}
45
45
  s.rdoc_options = ["--charset=UTF-8"]
46
46
  s.require_paths = ["lib"]
47
- s.rubygems_version = %q{1.3.5}
47
+ s.rubygems_version = %q{1.3.6}
48
48
  s.summary = %q{A declarative system for caching with ActiveRecord}
49
49
  s.test_files = [
50
50
  "test/active_record_sweeper_test.rb",
@@ -70,28 +70,48 @@ module CacheAdvance
70
70
  protected
71
71
 
72
72
  def read_from_store(key, add_to_key_list=true)
73
- data = @store.get(key)
74
- # this is to prevent a situation where the cached key list forgets
75
- # about keys that are actually cached.
76
- if data && add_to_key_list
77
- @cached_key_list.add_key(key)
73
+ begin
74
+ data = @store.get(key)
75
+ # this is to prevent a situation where the cached key list forgets
76
+ # about keys that are actually cached.
77
+ if data && add_to_key_list
78
+ @cached_key_list.add_key(key)
79
+ end
80
+ data
81
+ rescue MemCache::MemCacheError, Errno::ECONNREFUSED => exception
82
+ log_memcache_error(exception)
83
+ nil
78
84
  end
79
- data
80
85
  end
81
86
 
82
87
  def write_to_store(key, value)
83
- expiration_time ? @store.set(key, value, expiration_time) : @store.set(key, value)
84
- @cached_key_list.add_key(key)
88
+ begin
89
+ expiration_time ? @store.set(key, value, expiration_time) : @store.set(key, value)
90
+ @cached_key_list.add_key(key)
91
+ rescue MemCache::MemCacheError, Errno::ECONNREFUSED => exception
92
+ log_memcache_error(exception)
93
+ nil
94
+ end
85
95
  end
86
96
 
87
97
  def delete_from_store(key)
88
- @store.delete(key)
89
- @cached_key_list.delete_key(key)
98
+ begin
99
+ @store.delete(key)
100
+ @cached_key_list.delete_key(key)
101
+ rescue MemCache::MemCacheError, Errno::ECONNREFUSED => exception
102
+ log_memcache_error(exception)
103
+ nil
104
+ end
90
105
  end
91
106
 
92
107
  def delete_all_from_store
93
- @cached_key_list.all_keys.each { |key| delete_from_store(key) }
94
- @cached_key_list.clear
108
+ begin
109
+ @cached_key_list.all_keys.each { |key| delete_from_store(key) }
110
+ @cached_key_list.clear
111
+ rescue MemCache::MemCacheError, Errno::ECONNREFUSED => exception
112
+ log_memcache_error(exception)
113
+ nil
114
+ end
95
115
  end
96
116
 
97
117
  def each_plugin
@@ -120,5 +140,11 @@ module CacheAdvance
120
140
  def qualifiers
121
141
  Array(@params[:qualifiers])
122
142
  end
143
+
144
+ def log_memcache_error(exception)
145
+ if defined?(Rails) && Rails.respond_to?(:logger)
146
+ Rails.logger.error(exception.message)
147
+ end
148
+ end
123
149
  end
124
150
  end
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cache_advance
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 1
8
+ - 5
9
+ version: 1.1.5
5
10
  platform: ruby
6
11
  authors:
7
12
  - Aubrey Holland
@@ -9,7 +14,7 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2009-10-21 00:00:00 -04:00
17
+ date: 2010-03-01 00:00:00 -05:00
13
18
  default_executable:
14
19
  dependencies: []
15
20
 
@@ -59,18 +64,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
59
64
  requirements:
60
65
  - - ">="
61
66
  - !ruby/object:Gem::Version
67
+ segments:
68
+ - 0
62
69
  version: "0"
63
- version:
64
70
  required_rubygems_version: !ruby/object:Gem::Requirement
65
71
  requirements:
66
72
  - - ">="
67
73
  - !ruby/object:Gem::Version
74
+ segments:
75
+ - 0
68
76
  version: "0"
69
- version:
70
77
  requirements: []
71
78
 
72
79
  rubyforge_project:
73
- rubygems_version: 1.3.5
80
+ rubygems_version: 1.3.6
74
81
  signing_key:
75
82
  specification_version: 3
76
83
  summary: A declarative system for caching with ActiveRecord