<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Caching PHP objects: how to do it in 4 easy steps</title>
	<atom:link href="http://imgiseverything.co.uk/2008/05/23/caching-php-objects-cache/feed/" rel="self" type="application/rss+xml" />
	<link>http://imgiseverything.co.uk/2008/05/23/caching-php-objects-cache/</link>
	<description>Manchester web designer Phil Thompson</description>
	<pubDate>Thu, 04 Dec 2008 04:30:22 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: phil</title>
		<link>http://imgiseverything.co.uk/2008/05/23/caching-php-objects-cache/#comment-88776</link>
		<dc:creator>phil</dc:creator>
		<pubDate>Wed, 04 Jun 2008 14:12:10 +0000</pubDate>
		<guid isPermaLink="false">http://imgiseverything.co.uk/?p=253#comment-88776</guid>
		<description>@Jeff: I love your inquisitive mind and your educated guess is very warm but it isn't quite correct. I'll be posting more details about the top secret web app in the future.</description>
		<content:encoded><![CDATA[<p>@Jeff: I love your inquisitive mind and your educated guess is very warm but it isn&#8217;t quite correct. I&#8217;ll be posting more details about the top secret web app in the future.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff</title>
		<link>http://imgiseverything.co.uk/2008/05/23/caching-php-objects-cache/#comment-88758</link>
		<dc:creator>Jeff</dc:creator>
		<pubDate>Wed, 04 Jun 2008 11:43:24 +0000</pubDate>
		<guid isPermaLink="false">http://imgiseverything.co.uk/?p=253#comment-88758</guid>
		<description>Nice article Phil.  Joe Nobhead, haha!

I'm gonna hazard a guess that this is some sort of content management system?</description>
		<content:encoded><![CDATA[<p>Nice article Phil.  Joe Nobhead, haha!</p>
<p>I&#8217;m gonna hazard a guess that this is some sort of content management system?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: enzo</title>
		<link>http://imgiseverything.co.uk/2008/05/23/caching-php-objects-cache/#comment-88337</link>
		<dc:creator>enzo</dc:creator>
		<pubDate>Sun, 01 Jun 2008 18:53:02 +0000</pubDate>
		<guid isPermaLink="false">http://imgiseverything.co.uk/?p=253#comment-88337</guid>
		<description>fs cache sucks by default,
 try memory storage</description>
		<content:encoded><![CDATA[<p>fs cache sucks by default,<br />
 try memory storage</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: karuna</title>
		<link>http://imgiseverything.co.uk/2008/05/23/caching-php-objects-cache/#comment-88287</link>
		<dc:creator>karuna</dc:creator>
		<pubDate>Sun, 01 Jun 2008 10:48:34 +0000</pubDate>
		<guid isPermaLink="false">http://imgiseverything.co.uk/?p=253#comment-88287</guid>
		<description>i like the article... but the yellow... hurts after a while but if you like it well go ahead.</description>
		<content:encoded><![CDATA[<p>i like the article&#8230; but the yellow&#8230; hurts after a while but if you like it well go ahead.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: josh</title>
		<link>http://imgiseverything.co.uk/2008/05/23/caching-php-objects-cache/#comment-88208</link>
		<dc:creator>josh</dc:creator>
		<pubDate>Sat, 31 May 2008 18:32:24 +0000</pubDate>
		<guid isPermaLink="false">http://imgiseverything.co.uk/?p=253#comment-88208</guid>
		<description>Thanks for saving the internet a few microseconds</description>
		<content:encoded><![CDATA[<p>Thanks for saving the internet a few microseconds</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: phil</title>
		<link>http://imgiseverything.co.uk/2008/05/23/caching-php-objects-cache/#comment-87194</link>
		<dc:creator>phil</dc:creator>
		<pubDate>Mon, 26 May 2008 13:36:15 +0000</pubDate>
		<guid isPermaLink="false">http://imgiseverything.co.uk/?p=253#comment-87194</guid>
		<description>@Chris Gibson: In terms of benchmarking all I've done is to use &lt;code&gt;microtime()&lt;/code&gt; at the start of each page (on the website) and than at the end of each page convert that figure into the number of seconds it has taken to load the page.

An average(ish) figure is that for the site homepage, the load time was around 0.24 seconds and with the caching in place it became around 0.06 seconds. It also reduced the number of MySQL queries from 77 to 7.

It's worth pointing out the the reason for all these (77) queries was a number of recursive functions used to work out menus and see if certain pages were children of other pages. I haven't used the caching as a way to speed up objects but rather, as a way to reduce the number of times each page calls the database. I'm not sure how effective my method would be as a way to simply cache an object that makes no use of a database.</description>
		<content:encoded><![CDATA[<p>@Chris Gibson: In terms of benchmarking all I&#8217;ve done is to use <code>microtime()</code> at the start of each page (on the website) and than at the end of each page convert that figure into the number of seconds it has taken to load the page.</p>
<p>An average(ish) figure is that for the site homepage, the load time was around 0.24 seconds and with the caching in place it became around 0.06 seconds. It also reduced the number of MySQL queries from 77 to 7.</p>
<p>It&#8217;s worth pointing out the the reason for all these (77) queries was a number of recursive functions used to work out menus and see if certain pages were children of other pages. I haven&#8217;t used the caching as a way to speed up objects but rather, as a way to reduce the number of times each page calls the database. I&#8217;m not sure how effective my method would be as a way to simply cache an object that makes no use of a database.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dominik</title>
		<link>http://imgiseverything.co.uk/2008/05/23/caching-php-objects-cache/#comment-87158</link>
		<dc:creator>Dominik</dc:creator>
		<pubDate>Mon, 26 May 2008 10:35:26 +0000</pubDate>
		<guid isPermaLink="false">http://imgiseverything.co.uk/?p=253#comment-87158</guid>
		<description>@Daron, Drew and phil:

Actually Memcache is not so fast after all. I did some benchmarks of various "caching techniques" and was quite surprised that using the hard-disk for caching was considerably (about 30%) faster for reading and about 600 times faster for writing (in a local machine/one machine environment).

Either I did something terribly wrong with my benchmarks, or I'll probably go with using a Filesystem RAM-Disk for caching (haven't tried it's performance, yet).</description>
		<content:encoded><![CDATA[<p>@Daron, Drew and phil:</p>
<p>Actually Memcache is not so fast after all. I did some benchmarks of various &#8220;caching techniques&#8221; and was quite surprised that using the hard-disk for caching was considerably (about 30%) faster for reading and about 600 times faster for writing (in a local machine/one machine environment).</p>
<p>Either I did something terribly wrong with my benchmarks, or I&#8217;ll probably go with using a Filesystem RAM-Disk for caching (haven&#8217;t tried it&#8217;s performance, yet).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan</title>
		<link>http://imgiseverything.co.uk/2008/05/23/caching-php-objects-cache/#comment-87020</link>
		<dc:creator>Dan</dc:creator>
		<pubDate>Sun, 25 May 2008 19:31:03 +0000</pubDate>
		<guid isPermaLink="false">http://imgiseverything.co.uk/?p=253#comment-87020</guid>
		<description>The yellow... it's burning out my eyes!</description>
		<content:encoded><![CDATA[<p>The yellow&#8230; it&#8217;s burning out my eyes!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Gibson</title>
		<link>http://imgiseverything.co.uk/2008/05/23/caching-php-objects-cache/#comment-87003</link>
		<dc:creator>Chris Gibson</dc:creator>
		<pubDate>Sun, 25 May 2008 18:38:11 +0000</pubDate>
		<guid isPermaLink="false">http://imgiseverything.co.uk/?p=253#comment-87003</guid>
		<description>Good article. I'd be very interested to see some benchmarks that quantify the benefits of this caching method; are these available?

Also, this is nitpicking somewhat, but the "removeHours" function could perhaps be considered redundant. The standard strtotime function will interpret relative time descriptions, so you could just write:

strtotime('-1 hour');

... instead of removeHours([date], 1). To specify the start date, you'd write strtotime('-1 hour',strtotime([date])) or similar.

See: http://uk.php.net/manual/en/function.strtotime.php</description>
		<content:encoded><![CDATA[<p>Good article. I&#8217;d be very interested to see some benchmarks that quantify the benefits of this caching method; are these available?</p>
<p>Also, this is nitpicking somewhat, but the &#8220;removeHours&#8221; function could perhaps be considered redundant. The standard strtotime function will interpret relative time descriptions, so you could just write:</p>
<p>strtotime(&#8217;-1 hour&#8217;);</p>
<p>&#8230; instead of removeHours([date], 1). To specify the start date, you&#8217;d write strtotime(&#8217;-1 hour&#8217;,strtotime([date])) or similar.</p>
<p>See: <a href="http://uk.php.net/manual/en/function.strtotime.php" rel="nofollow">http://uk.php.net/manual/en/function.strtotime.php</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: phil</title>
		<link>http://imgiseverything.co.uk/2008/05/23/caching-php-objects-cache/#comment-86969</link>
		<dc:creator>phil</dc:creator>
		<pubDate>Sun, 25 May 2008 14:26:34 +0000</pubDate>
		<guid isPermaLink="false">http://imgiseverything.co.uk/?p=253#comment-86969</guid>
		<description>Thanks for everyone's comments and suggestions. Drew, that is exactly what I was after.

I'll be sure to check out Memcached, as recommended, but I'm not sure it'll be applicable to my particular situation.

@Brant: The example I give can quite easily be changed to not use a '.inc' extension, you could use anything you want.

@Drew: I try to namespace my cache files for the exact reasons you mention. It's easy to loop through a directory and then delete all files with that namespace if required. Sadly, this web app won't be able to make use of cron jobs (in most cases) but otherwise it's a good approach and I'll definitely check into using the /tmp file as the repository.</description>
		<content:encoded><![CDATA[<p>Thanks for everyone&#8217;s comments and suggestions. Drew, that is exactly what I was after.</p>
<p>I&#8217;ll be sure to check out Memcached, as recommended, but I&#8217;m not sure it&#8217;ll be applicable to my particular situation.</p>
<p>@Brant: The example I give can quite easily be changed to not use a &#8216;.inc&#8217; extension, you could use anything you want.</p>
<p>@Drew: I try to namespace my cache files for the exact reasons you mention. It&#8217;s easy to loop through a directory and then delete all files with that namespace if required. Sadly, this web app won&#8217;t be able to make use of cron jobs (in most cases) but otherwise it&#8217;s a good approach and I&#8217;ll definitely check into using the /tmp file as the repository.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
