Class: CarrierWave::Storage::Qiniu
- Inherits:
-
Abstract
- Object
- Abstract
- CarrierWave::Storage::Qiniu
- Defined in:
- lib/carrierwave/storage/qiniu.rb
Instance Method Summary collapse
- #cache!(file) ⇒ Object
- #clean_cache!(seconds) ⇒ Object
-
#delete_dir!(path) ⇒ Object
Deletes a cache dir.
- #retrieve!(identifier) ⇒ Object
- #retrieve_from_cache!(identifier) ⇒ Object
- #store!(file) ⇒ Object
Instance Method Details
#cache!(file) ⇒ Object
11 12 13 14 15 |
# File 'lib/carrierwave/storage/qiniu.rb', line 11 def cache!(file) QiniuFile.new(uploader, uploader.cache_path).tap do |qiniu_file| qiniu_file.store(file) end end |
#clean_cache!(seconds) ⇒ Object
32 33 34 35 |
# File 'lib/carrierwave/storage/qiniu.rb', line 32 def clean_cache!(seconds) # 如果缓存目录在云端,建议使用七牛云存储的生命周期设置, 以减少主动 API 调用次数 raise 'Use Qiniu Object Lifecycle Management to clean the cache' end |
#delete_dir!(path) ⇒ Object
Deletes a cache dir
28 29 30 |
# File 'lib/carrierwave/storage/qiniu.rb', line 28 def delete_dir!(path) # do nothing, because there's no such things as 'empty directory' end |
#retrieve!(identifier) ⇒ Object
17 18 19 |
# File 'lib/carrierwave/storage/qiniu.rb', line 17 def retrieve!(identifier) QiniuFile.new(uploader, uploader.store_path(identifier)) end |