IT Community - Software Programming, Web Development and Technical Support

Caching in php

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 ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > PHP Programming

Register FAQ Members List Calendar Mark Forums Read
  #1  
Old 08-06-2007, 08:54 AM
abhilashdas abhilashdas is offline
D-Web Trainee
 
Join Date: Aug 2007
Posts: 10
abhilashdas is on a distinguished road
Default Caching in php

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.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 08-06-2007, 10:42 PM
raj raj is offline
D-Web Programmer
 
Join Date: Jul 2007
Posts: 89
raj is on a distinguished road
Post Re: Caching in php

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
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

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


All times are GMT -7. The time now is 06:24 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
One Way Moving Companies | Stamford Dentist | Euro Millions Lottery | Home Loans| Furniture

SEO by vBSEO 3.0.0