keichan34 / exfile-imagemagick

An ImageMagick file processor suite for Exfile
MIT License
7 stars 7 forks source link

Caching in the /tmp #3

Open asiniy opened 8 years ago

asiniy commented 8 years ago

I like how does exfile-imagemagick works but it looks like it's not cache the results (even in the /tmp), what can lead developers to the problems on highloads.

In my opinion, ideal behaviour should be like that:

Exfile.Tempfile based on id, processor_name & processor_args should create a file in the /tmp folder.

In this case, if file is required to be rendered with some arguments too often, it'll be stored in the /tmp with name like /tmp/exfile/#{id}-#{processor_name}-#{processor_args} and wouldn't be generated on every new request, because filesystem will look at it first. What do you think?

keichan34 commented 8 years ago

I usually try to encourage users to use a HTTP cache, because that will skip exfile altogether. It might not hurt to have an extra layer of cache at this level, too.

It feels like a lot of reimplementing, though -- I have a similar mechanism in exfile-b2 to cache files. I think a general cache should either be implemented in exfile itself or in a separate hex package, what do you think?

asiniy commented 8 years ago

I think there is no need to implement specific mechanism for every exfile dependency, the main logic should be described in exfile itself.