Class Cachetastic::Adapters::HtmlFile
In: lib/cachetastic/adapters/html_file.rb
Parent: Cachetastic::Adapters::FileBase

Methods

get   set   store_file_name  

Constants

STORE_FILE_NAME = "index.html"

Public Instance methods

[Source]

    # File lib/cachetastic/adapters/html_file.rb, line 23
23:   def get(key)
24:     full_path = full_path_from_dir(get_key_directoy(key, false))
25:     return nil unless File.exists?(full_path)
26:     so = html_to_store_object(File.open(full_path).read)
27:     if so
28:       if so.invalid?
29:         self.delete(key)
30:         return nil
31:       end
32:       return so.value
33:     end
34:     return nil
35:   end

[Source]

    # File lib/cachetastic/adapters/html_file.rb, line 37
37:   def set(key, value, expiry = 0)
38:     so = Cachetastic::Adapters::StoreObject.new(key.to_s, value, expiry)
39:     File.open(full_path_from_key(key), "w") do |f|
40:       f.puts store_object_to_html(so)
41:     end
42:   end

Protected Instance methods

[Source]

    # File lib/cachetastic/adapters/html_file.rb, line 45
45:   def store_file_name
46:     return STORE_FILE_NAME
47:   end

[Validate]