Class: Apollo::Cache::BaseCache
- Inherits:
-
Object
- Object
- Apollo::Cache::BaseCache
- Defined in:
- lib/apollo_crawler/cache/base_cache.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#clear ⇒ Object
Clear cache.
-
#contains(key) ⇒ Object
Check if cache contains specified key.
-
#get(key, *args) ⇒ Object
Get value associated with key from cache.
-
#invalidate(key) ⇒ Object
Invalidate key/value pair.
-
#set(key, value) ⇒ Object
Set value associated with key Return cached value.
Instance Method Details
#clear ⇒ Object
Clear cache
52 53 54 |
# File 'lib/apollo_crawler/cache/base_cache.rb', line 52 def clear return end |
#contains(key) ⇒ Object
Check if cache contains specified key
42 43 44 |
# File 'lib/apollo_crawler/cache/base_cache.rb', line 42 def contains(key) return false end |
#get(key, *args) ⇒ Object
Get value associated with key from cache
25 26 27 28 29 30 31 32 33 |
# File 'lib/apollo_crawler/cache/base_cache.rb', line 25 def get(key, *args) # Not found, Create, cache and return if block_given? res = yield args end return res end |
#invalidate(key) ⇒ Object
Invalidate key/value pair
47 48 49 |
# File 'lib/apollo_crawler/cache/base_cache.rb', line 47 def invalidate(key) return true end |
#set(key, value) ⇒ Object
Set value associated with key Return cached value
37 38 39 |
# File 'lib/apollo_crawler/cache/base_cache.rb', line 37 def set(key, value) return value end |