简体   繁体   中英

Caching dynamically generated images in Rails

I am using PhantomJS to dynamically generate 10 large images of websites at a time in each request. Therefore it is important that I cache these images and check if they are cached so I can serve them up. I've never cached images before, so I have no idea how to do this.

Some other information:

PhantomJS writes images to your local filesystem at the path you specify.

I want to cache these images but also need to balance that with updating the cache if the websites have updated.

I will be running these image generation processes in parallel.

I'm thinking of using Amazon's Elastic MapReduce to take advantage of Hadoop and to help with the load. I've never used it before, so any advice here would be appreciated.

I am pretty much a complete noob with this, so in depth explanations with examples would be really helpful.

What's your front-end web server? Since PhantomJS can write images to your local filesystem at any path you specify, you should specify the document root of your web server so you're serving them statically. This way Rails doesn't even have to be involved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM