Class: Geocoder::CacheStore::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/geocoder/cache_stores/base.rb

Direct Known Subclasses

Generic, Redis

Instance Method Summary collapse

Constructor Details

#initialize(store, options) ⇒ Base

Returns a new instance of Base.



3
4
5
6
7
# File 'lib/geocoder/cache_stores/base.rb', line 3

def initialize(store, options)
  @store = store
  @config = options
  @prefix = config[:prefix]
end

Instance Method Details

#keysObject

Array of keys with the currently configured prefix that have non-nil values.



12
13
14
# File 'lib/geocoder/cache_stores/base.rb', line 12

def keys
  store.keys.select { |k| k.match(/^#{prefix}/) and self[k] }
end

#urlsObject

Array of cached URLs.



19
20
21
# File 'lib/geocoder/cache_stores/base.rb', line 19

def urls
  keys
end