Remove outdated edge case handling from Cache class
This commit is contained in:
parent
dbf24b2f6c
commit
0e6a6ff1fd
1 changed files with 5 additions and 12 deletions
17
lib/cache.rb
17
lib/cache.rb
|
@ -25,18 +25,14 @@ write a cache
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def self.write(key, data, params = {})
|
def self.write(key, data, params = {})
|
||||||
if !params[:expires_in]
|
params[:expires_in] ||= 7.days
|
||||||
params[:expires_in] = 7.days
|
|
||||||
end
|
|
||||||
|
|
||||||
# in certain cases, caches are deleted by other thread at same
|
# in certain cases, caches are deleted by other thread at same
|
||||||
# time, just log it
|
# time, just log it
|
||||||
begin
|
Rails.cache.write(key.to_s, data, params)
|
||||||
Rails.cache.write(key.to_s, data, params)
|
rescue => e
|
||||||
rescue => e
|
Rails.logger.error "Can't write cache #{key}: #{e.inspect}"
|
||||||
Rails.logger.error "Can't write cache #{key}: #{e.inspect}"
|
Rails.logger.error e
|
||||||
Rails.logger.error e
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
@ -60,9 +56,6 @@ clear whole cache store
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def self.clear
|
def self.clear
|
||||||
# workaround, set test cache before clear whole cache, Rails.cache.clear complains about not existing cache dir
|
|
||||||
Cache.write('test', 1)
|
|
||||||
|
|
||||||
Rails.cache.clear
|
Rails.cache.clear
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue