Class: Apollo::Cache::BaseCache
- Inherits:
-
Object
- Object
- Apollo::Cache::BaseCache
- Defined in:
- lib/apollo_crawler/cache/base_cache.rb
Direct Known Subclasses
MemcachedCache, MemoryCache, MongoCache, NullCache, SqliteCache
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ BaseCache
constructor
A new instance of BaseCache.
- #remove(key) ⇒ Object
-
#set(key, value) ⇒ Object
Set value associated with key Return cached value.
-
#try_get(key, *args) ⇒ Object
Get value associated with key from cache.
Constructor Details
#initialize(options = {}) ⇒ BaseCache
Returns a new instance of BaseCache.
24 25 |
# File 'lib/apollo_crawler/cache/base_cache.rb', line 24 def initialize( = {}) end |
Instance Method Details
#remove(key) ⇒ Object
44 45 46 |
# File 'lib/apollo_crawler/cache/base_cache.rb', line 44 def remove(key) # self.set(key, nil) end |
#set(key, value) ⇒ Object
Set value associated with key Return cached value
40 41 42 |
# File 'lib/apollo_crawler/cache/base_cache.rb', line 40 def set(key, value) return value end |
#try_get(key, *args) ⇒ Object
Get value associated with key from cache
28 29 30 31 32 33 34 35 36 |
# File 'lib/apollo_crawler/cache/base_cache.rb', line 28 def try_get(key, *args) # Not found, Create, cache and return if block_given? res = yield args end return res end |