If you are using the Dalli memcached gem, it is able to store binary data by using Rails.cache.fetch("foo", raw: true){Time.now}.
Btw, why do you want to cache it on server-side instead of delivering the S3 URL to the client? If the file is private, then you could use an authenticated URL with expiration
I played around with this issue, and the only solution that worked for me was adding an explicit flag to skip the processing:
ruby
defenqueue_imageImageWorker.perform_async(id, key) if key.present? && !skip_image_processing
enddefperform(id, key)
painting = Painting.find(id)
painting.key = key #setting the key again
painting.remote_image_url = painting.image.direct_fog_url(with_path:true)
painting.skip_image_processing = true
painting.save! # enqueue_image will get called again
painting.update_column(:image_processed, true)
end
If you are using the Dalli memcached gem, it is able to store binary data by using
Rails.cache.fetch("foo", raw: true){Time.now}
.Btw, why do you want to cache it on server-side instead of delivering the S3 URL to the client? If the file is private, then you could use an authenticated URL with expiration
I played around with this issue, and the only solution that worked for me was adding an explicit flag to skip the processing:
Any other, more elegant ideas?