Class: Apollo::Cache::BaseCache

Inherits:
Object
  • Object
show all
Defined in:
lib/apollo_crawler/cache/base_cache.rb

Instance Method Summary collapse

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(options = {})
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