class Apollo::Cache::SqliteCache

Constants

DEFAULT_OPTIONS

Public Instance Methods

get(key) click to toggle source
# File lib/apollo_crawler/cache/sqlite_cache.rb, line 39
def get(key)
        return nil
end
initilize(options = {}) click to toggle source
Calls superclass method
# File lib/apollo_crawler/cache/sqlite_cache.rb, line 33
def initilize(options = {})
        super(options)

        @options = DEFAULT_OPTIONS.merge(options)
end
set(key, value) click to toggle source

Set value associated with key Return cached value

# File lib/apollo_crawler/cache/sqlite_cache.rb, line 57
def set(key, value)
        return value
end
try_get(key, *args) { |args| ... } click to toggle source

Get value associated with key from cache

# File lib/apollo_crawler/cache/sqlite_cache.rb, line 44
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