# File lib/asciidoctor/renderer.rb, line 229 def initialize @cache = {} end
check if a key is available in the cache
# File lib/asciidoctor/renderer.rb, line 234 def cached? *key @cache.has_key? key end
Clears the cache
# File lib/asciidoctor/renderer.rb, line 255 def clear @cache = {} end
retrieves an item from the cache stored in the cache key if a block is given, the block is called and the return value stored in the cache under the specified key
# File lib/asciidoctor/renderer.rb, line 241 def fetch(*key) if block_given? @cache[key] ||= yield else @cache[key] end end
stores an item in the cache under the specified key
# File lib/asciidoctor/renderer.rb, line 250 def store(value, *key) @cache[key] = value end