class CarrierWave::Storage::Qiniu

Public Instance Methods

cache!(file) click to toggle source
# 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) click to toggle source
# 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) click to toggle source

Deletes a cache dir

# 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) click to toggle source
# File lib/carrierwave/storage/qiniu.rb, line 17
def retrieve!(identifier)
  QiniuFile.new(uploader, uploader.store_path(identifier))
end
retrieve_from_cache!(identifier) click to toggle source
# File lib/carrierwave/storage/qiniu.rb, line 21
def retrieve_from_cache!(identifier)
  QiniuFile.new(uploader, uploader.cache_path(identifier))
end
store!(file) click to toggle source
# File lib/carrierwave/storage/qiniu.rb, line 5
def store!(file)
  QiniuFile.new(uploader, uploader.store_path).tap do |qiniu_file|
    qiniu_file.store(file)
  end
end