|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Caching With PHP Cache_Lite
Caching With PHP Cache_Lite
June 06, 2003 - As Web applications become more and more complex, clever developers can use application-level caching to improve the performance of their PHP scripts. This article shows you how, discussing the PEAR Cache_Lite class with examples that illustrate how it can be used in a live environment. Please discuss this article in this thread. You can read the article here . |
|
#2
|
|||
|
|||
|
Cache and array
Hi guys,
Excellent article. Few questions: how cache_lite works with array? I tested with string, works perfect. This is a code from example except data is changed from string to array. <? ... if($data = $Cache_Lite->get('123')) { echo('Cache Hit !<br>'); foreach($data as $k) echo $k; } else { echo('Cache Missed !<br>'); $data = array(); for($i=0;$i<10;$i++) { $data[] = $i; } foreach($data as $j) echo $j; $Cache_Lite->save($data); } ... ?> all the time 'Cache Missed' message. Any ideas? Thanks a lot. |
|
#3
|
|||
|
|||
|
is it thread in diff forum?
subj.
Last edited by nz-dev : June 7th, 2003 at 05:55 PM. |
|
#4
|
|||
|
|||
|
Thanks but . . .
Thanks for the info. Nice article.
One of my concerns about PHP is scaleability. I guess there ocassions when you can foresee bottle necks that make it worth using caching but a more practical situation is where you need to use it to improve perfromance of existing applications. So my question is about how you decide where to use caching. Are there tools for dermining bottle necks in performance? Or maybe manual techniques? Perhaps another article from mr melonfire? Cheers |
|
#5
|
|||
|
|||
|
try the apachebench utility from apache.org to see whcih parts of your site are slow and might beenfit from caching
|
|
#6
|
|||
|
|||
|
forgive me, but i never played around with pear untill now,
does this work when having set a basedir restriction? and because this function is whinin pear, i figured you should do: require_once "PEAR.php"; at least, that is what it says in the pear documentation. but this also gives me: File(/usr/local/lib/php/PEAR.php) is not within the allowed path(s): the pear docu doesnt mention anything about basedir restrictions. i'm running php 4.3.1 so pear should be installed. any ideas? btw, nice article
__________________
you can get anything you want at alices restaurant |
|
#7
|
|||
|
|||
|
to gmilbourn
Useful for web services or databases. Rather then connect to "web service" server/db with high traffic (about 5000-7000 visitors per day) every minute, it is enough to cachce all dynamic pages for 3 hours and after check web service/db if data is changed.
|
|
#8
|
|||
|
|||
|
Quote:
Not sure about using basedir with PEAR, does it work if you remove the basedir restriction?
__________________
-- Articles, tutorials and more, all at http://www.melonfire.com/community/columns/trog/ |
|
#9
|
|||
|
|||
|
Can we use it stand-alone. I mean all I have to do is upload the cache lite package and use it without another PEAR package. I ask this cause not all ISP give PEAR.
thx |
|
#10
|
|||
|
|||
|
yes you can. however most PEAR packages require you to also ensure that the primary PEAR class be installed for error handling etc. you can install that one also manually, just remember to modify all the incldue() paths to point to the correct locations
|
|
#11
|
|||
|
|||
|
It works, but with an error message
When running the first example, I get this error:
Warning: Invalid argument supplied for foreach() in /home/virtual/site3/fst/usr/share/pear/Lite.php on line 228 That said, the caching does actually work. Reloading gives me the cached version. Setting error_reporting to zero hides the error just fine, and it does seem to work -- but any idea why this is happening? This also happens when I run the similar code from the similar tutorial distributed with the Lite.php class. I'm running PHP on an Ensim 3.5 Pro box, which may have something to do with it (I'm both the site administrator and the Appliance Administrator for this site & this Ensim installation). Joey www.moderntales.com |
![]() |
| Viewing: Dev Shed Forums > Other > Development Articles > Caching With PHP Cache_Lite |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|