lib/httparty-icebox.rb in jashmenn-httparty-icebox-0.0.3 vs lib/httparty-icebox.rb in jashmenn-httparty-icebox-0.0.4
- old
+ new
@@ -210,10 +210,10 @@
Cache.logger.info("Cache: set (#{key})")
File.open( @path.join(key), 'w' ) { |file| file << Marshal.dump(value) }
true
end
def get(key)
- data = Marshal.load(File.read( @path.join(key)))
+ data = Marshal.load(File.read( @path.join(key))) rescue nil
Cache.logger.info("Cache: #{data.nil? ? "miss" : "hit"} (#{key})")
data
end
def exists?(key)
File.exists?( @path.join(key) )