ruby - action caching and queued posts in rails -


I have a landing page on the rail with a "blog" style post, because it is the most visited page on the site. So, I'm using Action Caching. The cache is cleaned on the model change.

However, when adding new blog posts, I want to be able to create post in -future- (a la queue post in Tumblr).

So just going to see the model will not work anymore to clean the cache.

Is there a better way to clean the cache than doing the job from time to time (every half hour)?

You can use an end cache. If you have a cache backend memkach, this feature is supported by default. Otherwise, you need to make a key of a cache that contains a value that expires the cache after the scheduled time.

Or you can also follow another method. Instead of publishing publications where publised_at & lt; Time. Now (I'm assuming that your current behavior falls in this case), you can run a cron and update the status database field. In this way updates will trigger your cleaning staff and clean the cache.

The first solution is really the best.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -