Class: S3Repo::Cache
Overview
Cache object, stores S3 objects on disk
Constant Summary collapse
- TMPDIRS =
[ ENV['TMPDIR'], Dir.tmpdir, '/tmp/s3repo' ].freeze
Instance Method Summary collapse
- #download(key, refresh = true) ⇒ Object
-
#initialize(params = {}) ⇒ Cache
constructor
A new instance of Cache.
Constructor Details
#initialize(params = {}) ⇒ Cache
Returns a new instance of Cache.
15 16 17 18 |
# File 'lib/s3repo/cache.rb', line 15 def initialize(params = {}) super [partialdir, cachedir].each { |x| FileUtils.mkdir_p x } end |
Instance Method Details
#download(key, refresh = true) ⇒ Object
20 21 22 23 24 |
# File 'lib/s3repo/cache.rb', line 20 def download(key, refresh = true) path = key get_object(key, path) if refresh || !cached?(path) path end |