Skip to content
Snippets Groups Projects
Commit 7da2c18d authored by PavelT's avatar PavelT
Browse files

[185] Cache with :get and :set methods only

parent 8a5c8df4
No related branches found
No related tags found
No related merge requests found
......@@ -10,14 +10,24 @@ module Geocoder
# Read from the Cache.
#
def [](url)
interpret store[key_for(url)]
interpret case
when store.respond_to?(:[])
store[key_for(url)]
when store.respond_to?(:get)
store.get key_for(url)
end
end
##
# Write to the Cache.
#
def []=(url, value)
store[key_for(url)] = value
case
when store.respond_to?(:[]=)
store[key_for(url)] = value
when store.respond_to?(:set)
store.set key_for(url), value
end
end
##
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment