Saturday, August 28, 2010

Re: In Cache settings, what is "probability"?

I found this line in cake/libs/cache.php:

if (time() % $_this->_Engine[$name]->settings['probability'] === 0) {
$_this->_Engine[$name]->gc();
}

It means that the cache will be cleared if timestamp modulo
probability hits 0. So as higher the probability as longer the cache
file lives. You could use it if you say that after probable 100 hits
the cache expires.

On 27 Aug., 17:06, "j.blotus" <j.blo...@gmail.com> wrote:
> Cache::config('long', array(
>     'engine' => 'File',
>     'duration'=> '+1 week',
>     'probability'=> 100,
>     'path' => CACHE . 'long' . DS,
> ));
>
> what does "propability" do? I can not find an explanation for it

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: