![]() |
Language Reference » pCache functions » remove
|
|
Latest updates
Toolbox
Google AdSense
|
remove - Remove one object from the cache This function allows you to remove one object of the cache based on its unique ID. As removing an object from the cache require a whole rebuild of the cache index and cache database this action will take an amount of time linked to the number of objects contained in the cache. Calling this function
remove($ID) ID is the unique ID associated to the cache object. This ID can be manually defined or hash-based. Sample script If the object is already in the database, it will be re-generated and pushed back to the cache : ![]() /* Include all the classes */ include("class/pDraw.class.php"); include("class/pImage.class.php"); include("class/pData.class.php"); include("class/pCache.class.php"); /* Create your dataset object */ $myData = new pData(); /* Add data in your dataset */ $myData->addPoints(array(1,3,4,3,5)); /* Create the cache object */ $myCache = new pCache(); /* Compute the hash linked to the chart data */ $ChartHash = $myCache->getHash($myData); /* Test if we got this hash in our cache already and remove it */ if ( $myCache->isInCache($ChartHash)) { $myCache->remove($ChartHash); } /* Create a pChart object and associate your dataset */ $myPicture = new pImage(700,230,$myData); /* Choose a nice font */ $myPicture->setFontProperties(array("FontName"=>"fonts/Forgotte.ttf","FontSize"=>11)); /* Define the boundaries of the graph area */ $myPicture->setGraphArea(60,40,670,190); /* Draw the scale, keep everything automatic */ $myPicture->drawScale(); /* Draw the scale, keep everything automatic */ $myPicture->drawSplineChart(); /* Do some cosmetics */ $myPicture->drawGradientArea(0,0,700,20,DIRECTION_VERTICAL,array("StartR"=>0,"StartG"=>0,"StartB"=>0,"EndR"=>50,"EndG"=>50,"EndB"=>50,"Alpha"=>100)); $myPicture->setFontProperties(array("FontName"=>"fonts/Silkscreen.ttf","FontSize"=>6)); $myPicture->drawText(10,13,"Test of the pCache class",array("R"=>255,"G"=>255,"B"=>255)); /* Push the rendered picture to the cache */ $myCache->writeToCache($ChartHash,$myPicture); /* Render the picture */ $myPicture->Render("cache.png");
© Copyrights
Components used on this web site : Famfamfam icons has been made by Mark James, Rounded corners lite has been coded by Cameron Cooke and Tim Hutchison, SyntaxHighlighter has
been written by Alex Gorbatchev. pChart and this web site have been created by Jean-Damien POGOLOTTI. This documentation contains 185 pages and 56 comments. 415 users have registered.
This page has been rendered in 0,01 seconds. Wiki revision 1.37.
|