Skip to content
Snippets Groups Projects
Commit 1ce9e0f2 authored by Alex Reisner's avatar Alex Reisner
Browse files

Merge pull request #404 from robdiciuccio/cache

Make Geocoder.cache return Geocoder::Cache instance instead of underlying cache store.
parents b3006294 b082bccd
No related branches found
No related tags found
No related merge requests found
...@@ -44,7 +44,7 @@ module Geocoder ...@@ -44,7 +44,7 @@ module Geocoder
# #
def cache def cache
warn "WARNING: Calling Geocoder.cache is DEPRECATED. The #cache method now belongs to the Geocoder::Lookup object." warn "WARNING: Calling Geocoder.cache is DEPRECATED. The #cache method now belongs to the Geocoder::Lookup object."
Geocoder::Lookup.get(Geocoder.config.lookup).send(:configuration).cache Geocoder::Lookup.get(Geocoder.config.lookup).cache
end end
end end
......
...@@ -72,6 +72,16 @@ module Geocoder ...@@ -72,6 +72,16 @@ module Geocoder
def query_url(query) def query_url(query)
fail fail
end end
##
# The working Cache object.
#
def cache
if @cache.nil? and store = configuration.cache
@cache = Cache.new(store, configuration.cache_prefix)
end
@cache
end
private # ------------------------------------------------------------- private # -------------------------------------------------------------
...@@ -225,16 +235,6 @@ module Geocoder ...@@ -225,16 +235,6 @@ module Geocoder
end end
end end
##
# The working Cache object.
#
def cache
if @cache.nil? and store = configuration.cache
@cache = Cache.new(store, configuration.cache_prefix)
end
@cache
end
## ##
# Simulate ActiveSupport's Object#to_query. # Simulate ActiveSupport's Object#to_query.
# Removes any keys with nil value. # Removes any keys with nil value.
......
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