class Tilda::Cache

Public Class Methods

new(cache_path = nil) click to toggle source
# File lib/tilda/cache.rb, line 3
def initialize(cache_path = nil)
  @cache_path = cache_path || Config.config.cache_path
  if @cache_path.nil?
    @cache_path = defined?(Rails) ? "#{Rails.public_path}/tilda/" : "/tmp/tilda/"
  end
end

Public Instance Methods

cache_page(id) click to toggle source
# File lib/tilda/cache.rb, line 14
def cache_page(id)

end
clear_page(page) click to toggle source

private

# File lib/tilda/cache.rb, line 24
def clear_page(page)
  FileUtils.rmdir(get_page_fullpath(page), noop: true, verbose: true) #TODO: really do nothing
end
get_cached_page(id) click to toggle source
# File lib/tilda/cache.rb, line 10
def get_cached_page(id)
  @cache_path
end
get_page_by_id() click to toggle source
# File lib/tilda/cache.rb, line 18
def get_page_by_id

end
get_page_dirname(page) click to toggle source
# File lib/tilda/cache.rb, line 28
def get_page_dirname(page)
  "#{page.get_html_filename}__#{page.get_published_timestamp}"
end
get_page_fullpath(page) click to toggle source
# File lib/tilda/cache.rb, line 32
def get_page_fullpath(page)
  "#{@cache_path}/#{get_page_dirname(page)}"
end

Private Instance Methods

mk_path(path) click to toggle source
# File lib/tilda/cache.rb, line 38
def mk_path(path)
  FileUtils.mkdir_p(path) unless File.directory?(path)
end