lib/libcache/file_cache.rb in libcache-0.1.0 vs lib/libcache/file_cache.rb in libcache-0.2.0
- old
+ new
@@ -22,26 +22,22 @@
invalidate key
end
end
def get(key)
- if @cache[key] == nil
- val = refresh.call(key)
- put(key, val)
- return val
- end
+ refresh
return File.read(File.join(store, key.to_s))
end
def invalidate(key)
super
File.delete(File.join(store, key.to_s))
end
def invalidateAll
super
- Dir.foreach(store) { |f|
+ Dir.foreach(store) do |f|
File.delete(File.join(store, f)) if f != '.' && f != '..'
- }
+ end
end
end
\ No newline at end of file