Class: Apollo::Cache::NullCache

Inherits:
BaseCache show all
Defined in:
lib/apollo_crawler/cache/null_cache.rb

Instance Method Summary collapse

Methods inherited from BaseCache

#initialize, #remove

Constructor Details

This class inherits a constructor from Apollo::Cache::BaseCache

Instance Method Details

#get(key) ⇒ Object



30
31
32
# File 'lib/apollo_crawler/cache/null_cache.rb', line 30

def get(key)
	nil
end

#initilize(options = {}) ⇒ Object



26
27
28
# File 'lib/apollo_crawler/cache/null_cache.rb', line 26

def initilize(options = {})
	super(options)
end

#set(key, value) ⇒ Object

Set value associated with key Return cached value



48
49
50
# File 'lib/apollo_crawler/cache/null_cache.rb', line 48

def set(key, value)
	return value
end

#try_get(key, *args) ⇒ Object

Get value associated with key from cache



35
36
37
38
39
40
41
42
43
44
# File 'lib/apollo_crawler/cache/null_cache.rb', line 35

def try_get(key, *args)
	res = get(key)

	# Not found, Create, cache and return
	if res.nil? && block_given?
		res = yield args
	end
	
	return res
end