lib/geocoder/cache.rb in geocoder-1.0.3 vs lib/geocoder/cache.rb in geocoder-1.0.4

- old
+ new

@@ -19,18 +19,18 @@ def []=(url, value) store[key_for(url)] = value end ## - # Expire cache entry for given URL, - # or pass <tt>:all</tt> to expire everything. + # Delete cache entry for given URL, + # or pass <tt>:all</tt> to clear all URLs. # def expire(url) if url == :all urls.each{ |u| expire(u) } else - self[url] = nil + expire_single_url(url) end end private # ---------------------------------------------------------------- @@ -63,8 +63,12 @@ # Clean up value before returning. Namely, convert empty string to nil. # (Some key/value stores return empty string instead of nil.) # def interpret(value) value == "" ? nil : value + end + + def expire_single_url(url) + store.del(key_for(url)) end end end