carrierwaveuploader / carrierwave-aws

AWS-SDK storage adapter for CarrierWave
MIT License
409 stars 107 forks source link

Caching seems to not work #170

Closed khataev closed 3 years ago

khataev commented 3 years ago

I have default settings from gem readme. My uploader looks like

module Uploaders
  module TaxBaseCalculation
    class Xlsx  < CarrierWave::Uploader::Base
      storage :aws

      def store_dir
        "tax_base_calculation/xlsx/user_#{model.order.user_id}/order_#{model.order_id}/calculation_#{model.id}"
      end

      def extension_whitelist
        %w[xlsx]
      end

      def cache_dir
        Rails.root.join 'tmp/uploads'
      end
    end
  end
end

this is how I try to cache file

file.cache_stored_file!
file.retrieve_from_cache!(file.cache_name)

# operation is successful, but there is no file in cache folder:

puts "path: #{file.path}, exists?: #{File.exist?(file.path)}"
# => false

# cache_name and path attributes are correct
file.cache_name
# => "1614070761-355256537201132-0002-4079/73753502-55_Расчет_налоговой_базы.xlsx"

file.path
# => "tmp/uploads/1614070761-355256537201132-0002-4079/73753502-55_Расчет_налоговой_базы.xlsx"
sorentwo commented 3 years ago

Caching is entirely handled by CarrierWave itself, not carrierwave-aws. Please ask over there or check the past issues.