Reputation: 31736
I am generating a big sitemap for a site and using page caching on it, so that a sitemap.xml is generated in my public folder.
Is there a way to have this page expire after say 3.days?
I've looked but couldn't find anything that could do that.
Upvotes: 2
Views: 1765
Reputation: 1794
Set up a cron job to delete it:
cd /home/user/apps/myapp/current/public/ && rm sitemap.xml
If you use Whenever this should do the trick:
every 3.days, :at => '1:00am' do
command "cd /home/user/apps/myapp/current/public/ && rm sitemap.xml"
end
If you want to regenerate the file immediately add the following:
&& curl http://www.example.com/sitemap.xml
Upvotes: 5