[nycphp-talk] Cache package suggestions

Cliff Hirsch cliff at
Fri Aug 17 14:07:57 EDT 2007

On 8/17/07 1:56 PM, "John Campbell" <jcampbell1 at> wrote:

>> I received offline regarding the midnight issue is to dynamically
>> calculate the lifetime to midnight for each request. But this does add some
>> calculation overhead for each request.
> A common solution to this class of problem, is to only run the routine
> if the request draws the unlucky lottery number... for example the
> default PHP session garbage collection routine operates like:
> if(rand(0,100) == 42) {
> cleanup_expired_sessions();
> }

How about setting the cache lifetime for each request to:
  mktime(0, 0, 0, date("m"), date("d")+1, date("Y")) - time();

More information about the talk mailing list