Class: Tilda::Cache
- Inherits:
-
Object
- Object
- Tilda::Cache
- Defined in:
- lib/tilda/cache.rb
Instance Method Summary collapse
- #cache_page(id) ⇒ Object
-
#clear_page(page) ⇒ Object
private.
- #get_cached_page(id) ⇒ Object
- #get_page_by_id ⇒ Object
- #get_page_dirname(page) ⇒ Object
- #get_page_fullpath(page) ⇒ Object
-
#initialize(cache_path = nil) ⇒ Cache
constructor
A new instance of Cache.
Constructor Details
#initialize(cache_path = nil) ⇒ Cache
Returns a new instance of Cache.
3 4 5 6 7 8 |
# 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 |
Instance Method Details
#cache_page(id) ⇒ Object
14 15 16 |
# File 'lib/tilda/cache.rb', line 14 def cache_page(id) end |
#clear_page(page) ⇒ Object
private
24 25 26 |
# 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) ⇒ Object
10 11 12 |
# File 'lib/tilda/cache.rb', line 10 def get_cached_page(id) @cache_path end |
#get_page_by_id ⇒ Object
18 19 20 |
# File 'lib/tilda/cache.rb', line 18 def get_page_by_id end |
#get_page_dirname(page) ⇒ Object
28 29 30 |
# File 'lib/tilda/cache.rb', line 28 def get_page_dirname(page) "#{page.get_html_filename}__#{page.}" end |
#get_page_fullpath(page) ⇒ Object
32 33 34 |
# File 'lib/tilda/cache.rb', line 32 def get_page_fullpath(page) "#{@cache_path}/#{get_page_dirname(page)}" end |