Solved

Apache: Cache Item for Random Period

Posted on 2013-06-25
3
188 Views
Last Modified: 2013-07-09
Using Apache, is there any way to randomize the length of time that an item is cached?  I would like an item to be cached for a random period between 604800 seconds and 1209600 seconds.
Header set Cache-Control "public, max-age=" (random number between 604800 and 1209600)

Open in new window

0
Comment
Question by:hankknight
  • 2
3 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 39275348
Just use rand in the header
rand(604800, 1209600);
0
 
LVL 16

Author Comment

by:hankknight
ID: 39281393
rand is a PHP function.  I need to do this with Apache in the .htaccess file.
0
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 39282051
Ok, sorry. It's not directly possible, one possibility is http://httpd.apache.org/docs/current/rewrite/rewritemap.html#prg
But this is beyond my knowing, request attention to add perl to the topics - if it's something your interested in.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now