class Asciidoctor::TemplateCache

Attributes

cache[R]

Public Class Methods

new() click to toggle source
# File lib/asciidoctor/renderer.rb, line 229
def initialize
  @cache = {}
end

Public Instance Methods

cached?(*key) click to toggle source

check if a key is available in the cache

# File lib/asciidoctor/renderer.rb, line 234
def cached? *key
  @cache.has_key? key
end
clear() click to toggle source

Clears the cache

# File lib/asciidoctor/renderer.rb, line 255
def clear
  @cache = {}
end
fetch(*key) { || ... } click to toggle source

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
store(value, *key) click to toggle source

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