For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > May 2006 > Re: [PEAR] cache_lite cleanup problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PEAR] cache_lite cleanup problem
Pierre

2006-05-24, 7:01 pm

On 5/23/06, Jason Chancellor <jc_groups@aoasoftware.com> wrote:
> I'm struggling to figure out what I'm doing wrong as it appears for some
> reason my lifeTime option is not working properly. I am testing on a
> Windows XP box running PHP 5.0.4 and running cache_lite version 1.7.1
>
> All I want to do is create a save a cache file, and then after 10 second=

s,
> the cache file goes away. However, in this example I am posting, my cac=

he
> file never goes away (although it does get saved and accessed properly). =

My
> understanding was that on the "get" function it would cleanup the cache f=

ile
> if it had passed its expiration. Anyone know what I'm doing wrong here?


Yes, the get method will check the expiration.

Do you mean that you never reached "Cache Miss"?

--Pierre


The code
> //-----------
> require_once "Cache/Lite.php";
>
> $options =3D array(
> 'cacheDir' =3D> "c:/temp/results/",
> 'lifeTime' =3D> 10,
> 'pearErrorMode' =3D> CACHE_LITE_ERROR_DIE,
> 'automaticSerialization' =3D> TRUE,
> 'automaticCleaningFactor' =3D> 2
> );
>
> $cache =3D new Cache_Lite($options);
>
> //Save the cache
> if (isset($_REQUEST["save"]))
> {
> $cache->save("hi", "CACHEABC", "GROUP123");
> print "Saved"."<br>";
> return;
> }
>
> //Print out cache
> if ( $cacheData =3D $cache->get("CACHEABC", "GROUP123") )
> {
> print "Cache Hit: ".$cacheData."<br>";
> }
> else
> {
> print "Cache Miss"."<br>";
> }
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Jason Chancellor

2006-05-24, 7:01 pm

Yes, it never prints Cache Miss, and the cache file never get deleted.

I would assume that I would get a Cache Miss after 10 seconds, but thats
not the case for some reason.


"Pierre" <pierre.php@gmail.com> wrote in message
news:fe05d1540605241407r214dc592p35dbdfc
84434360d@mail.gmail.com...
On 5/23/06, Jason Chancellor <jc_groups@aoasoftware.com> wrote:
> <--SNIP -->

Yes, the get method will check the expiration.

Do you mean that you never reached "Cache Miss"?

--Pierre


The code
> //-----------
> require_once "Cache/Lite.php";
>
> $options = array(
> 'cacheDir' => "c:/temp/results/",
> 'lifeTime' => 10,
> 'pearErrorMode' => CACHE_LITE_ERROR_DIE,
> 'automaticSerialization' => TRUE,
> 'automaticCleaningFactor' => 2
> );
>
> $cache = new Cache_Lite($options);
>
> //Save the cache
> if (isset($_REQUEST["save"]))
> {
> $cache->save("hi", "CACHEABC", "GROUP123");
> print "Saved"."<br>";
> return;
> }
>
> //Print out cache
> if ( $cacheData = $cache->get("CACHEABC", "GROUP123") )
> {
> print "Cache Hit: ".$cacheData."<br>";
> }
> else
> {
> print "Cache Miss"."<br>";
> }
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com