Improved error handling on many concurrent cache file writes/deletes. Do not raise exemption if write was not successfully.
This commit is contained in:
parent
450984719c
commit
ba75b4a0de
|
@ -8,7 +8,11 @@ module Cache
|
||||||
params[:expires_in] = 24.hours
|
params[:expires_in] = 24.hours
|
||||||
end
|
end
|
||||||
# puts 'Cache.write: ' + key.to_s
|
# puts 'Cache.write: ' + key.to_s
|
||||||
Rails.cache.write( key.to_s, data, params)
|
begin
|
||||||
|
Rails.cache.write( key.to_s, data, params)
|
||||||
|
rescue Exception => e
|
||||||
|
puts "NOTICE: #{e.message}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
def self.get( key )
|
def self.get( key )
|
||||||
# puts 'Cache.get: ' + key.to_s
|
# puts 'Cache.get: ' + key.to_s
|
||||||
|
@ -17,7 +21,7 @@ module Cache
|
||||||
def self.clear
|
def self.clear
|
||||||
# puts 'Cache.clear...'
|
# puts 'Cache.clear...'
|
||||||
# workaround, set test cache before clear whole cache, Rails.cache.clear complains about not existing cache dir
|
# workaround, set test cache before clear whole cache, Rails.cache.clear complains about not existing cache dir
|
||||||
Cache.write('test',1 )
|
Cache.write( 'test', 1 )
|
||||||
|
|
||||||
Rails.cache.clear
|
Rails.cache.clear
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue