This is a discussion on Caching in php within the PHP Programming forums, part of the Web Development category; Can anybody tell me how to cache a dynamically generated page for some time using php. Home page of my ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| |||
| |||
| Can anybody tell me how to cache a dynamically generated page for some time using php. Home page of my site involve certain dynamic contents but remains constant for some time. So rather than using database for all requests it would be better if i could serve the client from the cache. Please help. |
|
#2
| |||
| |||
| Hi, First you need to install memcache API. you can store db values to cached once then you can get the values from cache every time using this memcache class. you can delete the memcached values by expiry time or while any db value changes. If your page is dynamic, you should delete the memcache when you change db values related that dynamic pages eg: $oMemCache = new Memcache; $oMemCache -> addServer('host', portnumber); if($oMemCache->get('your_memcached_key')) { print $oMemCache->get('your_memcached_key'); } else { //#--- Get your db result & then stored into memcache key $vDBValue = from sql result; $oMemCache->set('your_memcached_key', $vDBValue); } for more details refer this url: memcached: a distributed memory object caching system |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Explain how Caching in Asp.net 2.0 is different from Caching in Asp.net 1.1? | Arun | ASP and ASP.NET Programming | 6 | 09-19-2007 09:15 PM |
| What are the Types of caching in dot net 2005? | Archer | ASP and ASP.NET Programming | 12 | 08-18-2007 02:00 AM |
| How do we prevent browser from caching output of my JSP pages? | oxygen | Java Server Pages (JSP) | 1 | 07-26-2007 03:45 AM |
| How caching will help to improve the performance of asp .net application? | kingmaker | ASP and ASP.NET Programming | 1 | 07-20-2007 05:32 AM |
| ASP Caching | nhoj | ASP and ASP.NET Programming | 0 | 04-09-2007 08:12 AM |
Our Partners |