Solved

Apache: Cache Item for Random Period

Posted on 2013-06-25
3
191 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

803 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