Class: Rhinestone::FilesystemCacheBackend

Inherits:
Object
  • Object
show all
Defined in:
lib/rhinestone/filesystem_cache_backend.rb

Instance Method Summary collapse

Instance Method Details

#get(key) ⇒ Object



8
9
10
# File 'lib/rhinestone/filesystem_cache_backend.rb', line 8

def get(key)
  File.read(file_name(key)) rescue nil
end

#set(key, value) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/rhinestone/filesystem_cache_backend.rb', line 12

def set(key, value)
  file = file_name(key)
  FileUtils.mkdir_p(File.dirname(file))
  File.open(file, "w") do |f|
    f.write value
  end
end