class Adhoq::Storage::Cache
Attributes
Public Class Methods
Source
# File lib/adhoq/storage/cache.rb, line 6 def initialize(cache, prefix = "", expire = 300) @cache = cache @identifier = @prefix = prefix @expire = expire end
Public Instance Methods
Source
# File lib/adhoq/storage/cache.rb, line 18 def direct_download? false end
Source
# File lib/adhoq/storage/cache.rb, line 22 def get(identifier) @cache.read(@prefix + identifier) end
Source
# File lib/adhoq/storage/cache.rb, line 12 def store(suffix = nil, seed = Time.now, &block) Adhoq::Storage.with_new_identifier(suffix, seed) do |identifier| @cache.write(@prefix + identifier, yield.read, expires_in: @expire) end end