class CarrierWave::Storage::AWS

Public Class Methods

clear_connection_cache!() click to toggle source
# File lib/carrierwave/storage/aws.rb, line 12
def self.clear_connection_cache!
  @connection_cache = {}
end
connection_cache() click to toggle source
# File lib/carrierwave/storage/aws.rb, line 8
def self.connection_cache
  @connection_cache ||= {}
end

Public Instance Methods

cache!(file) click to toggle source
# File lib/carrierwave/storage/aws.rb, line 26
def cache!(file)
  AWSFile.new(uploader, connection, uploader.cache_path).tap do |aws_file|
    aws_file.store(file)
  end
end
clean_cache!(_seconds) click to toggle source
# File lib/carrierwave/storage/aws.rb, line 40
def clean_cache!(_seconds)
  raise 'use Object Lifecycle Management to clean the cache'
end
connection() click to toggle source
# File lib/carrierwave/storage/aws.rb, line 44
def connection
  @connection ||= begin
    conn_cache = self.class.connection_cache

    conn_cache[credentials] ||= ::Aws::S3::Resource.new(*credentials)
  end
end
credentials() click to toggle source
# File lib/carrierwave/storage/aws.rb, line 52
def credentials
  [uploader.aws_credentials].compact
end
delete_dir!(path) click to toggle source
# File lib/carrierwave/storage/aws.rb, line 36
def delete_dir!(path)
  # NOTE: noop, because there are no directories on S3
end
retrieve!(identifier) click to toggle source
# File lib/carrierwave/storage/aws.rb, line 22
def retrieve!(identifier)
  AWSFile.new(uploader, connection, uploader.store_path(identifier))
end
retrieve_from_cache!(identifier) click to toggle source
# File lib/carrierwave/storage/aws.rb, line 32
def retrieve_from_cache!(identifier)
  AWSFile.new(uploader, connection, uploader.cache_path(identifier))
end
store!(file) click to toggle source
# File lib/carrierwave/storage/aws.rb, line 16
def store!(file)
  AWSFile.new(uploader, connection, uploader.store_path).tap do |aws_file|
    aws_file.store(file)
  end
end