Solved

Apache: Cache Item for Random Period

Posted on 2013-06-25
3
195 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

738 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