<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Caching dependency-injected objects</title>
	<atom:link href="http://www.davegardner.me.uk/blog/2010/03/22/caching-dependency-injected-objects-with-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.davegardner.me.uk/blog/2010/03/22/caching-dependency-injected-objects-with-php/</link>
	<description>Just behind the bleeding edge of PHP.</description>
	<lastBuildDate>Sun, 11 Sep 2011 18:49:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Dave</title>
		<link>http://www.davegardner.me.uk/blog/2010/03/22/caching-dependency-injected-objects-with-php/comment-page-1/#comment-518</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Fri, 26 Mar 2010 08:32:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.davegardner.me.uk/blog/?p=89#comment-518</guid>
		<description>Interesting idea regarding the use of the Observer pattern, Mark. I must admit I haven&#039;t yet got into any optimisations. I will have to get a profiler on it at some point.</description>
		<content:encoded><![CDATA[<p>Interesting idea regarding the use of the Observer pattern, Mark. I must admit I haven&#8217;t yet got into any optimisations. I will have to get a profiler on it at some point.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://www.davegardner.me.uk/blog/2010/03/22/caching-dependency-injected-objects-with-php/comment-page-1/#comment-517</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Fri, 26 Mar 2010 08:25:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.davegardner.me.uk/blog/?p=89#comment-517</guid>
		<description>Some interesting points Giorgio. I accept that I shouldn&#039;t use __!

Using setter rather than construction injection may be a good way to go regarding reusing the interface. My __restoreDependencies method could be simply setDependencies to make things simpler.

However the problem would still remain that the injection would not be performed &lt;em&gt;automatically&lt;/em&gt; after unserialize().</description>
		<content:encoded><![CDATA[<p>Some interesting points Giorgio. I accept that I shouldn&#8217;t use __!</p>
<p>Using setter rather than construction injection may be a good way to go regarding reusing the interface. My __restoreDependencies method could be simply setDependencies to make things simpler.</p>
<p>However the problem would still remain that the injection would not be performed <em>automatically</em> after unserialize().</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Baker</title>
		<link>http://www.davegardner.me.uk/blog/2010/03/22/caching-dependency-injected-objects-with-php/comment-page-1/#comment-515</link>
		<dc:creator>Mark Baker</dc:creator>
		<pubDate>Thu, 25 Mar 2010 20:41:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.davegardner.me.uk/blog/?p=89#comment-515</guid>
		<description>An excellent article
I&#039;ve been working on something similar myself, using the observer pattern with my cacheable objects to trigger the caching whenever they are modified in any way. Surprisingly, I found that it was more efficient in terms of execution time to call a detach() method to set the observer property to null rather than use the __sleep() magic method. Perhaps it was the overhead of needing to return an array of the properties that I did want serializing, and it might vary from object to object.
While I haven&#039;t had any problems with caching to APC, memcache, a disk file, or php://temp; I&#039;ve found that caching the serialized objects to a simple array is giving me intermittent memory leakage. Despite setting the observer property of the objects to null before serializing, I&#039;m still getting orphaned instances left in the memory, as I would if the the observer property refcount wasn&#039;t yet 0. I&#039;m wondering if the garbage clearance hasn&#039;t kicking in quickly enough to clear the cyclic reference.</description>
		<content:encoded><![CDATA[<p>An excellent article<br />
I&#8217;ve been working on something similar myself, using the observer pattern with my cacheable objects to trigger the caching whenever they are modified in any way. Surprisingly, I found that it was more efficient in terms of execution time to call a detach() method to set the observer property to null rather than use the __sleep() magic method. Perhaps it was the overhead of needing to return an array of the properties that I did want serializing, and it might vary from object to object.<br />
While I haven&#8217;t had any problems with caching to APC, memcache, a disk file, or php://temp; I&#8217;ve found that caching the serialized objects to a simple array is giving me intermittent memory leakage. Despite setting the observer property of the objects to null before serializing, I&#8217;m still getting orphaned instances left in the memory, as I would if the the observer property refcount wasn&#8217;t yet 0. I&#8217;m wondering if the garbage clearance hasn&#8217;t kicking in quickly enough to clear the cyclic reference.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Nieto</title>
		<link>http://www.davegardner.me.uk/blog/2010/03/22/caching-dependency-injected-objects-with-php/comment-page-1/#comment-514</link>
		<dc:creator>Jonathan Nieto</dc:creator>
		<pubDate>Thu, 25 Mar 2010 19:44:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.davegardner.me.uk/blog/?p=89#comment-514</guid>
		<description>Really interesting!

Thanks for sharing!</description>
		<content:encoded><![CDATA[<p>Really interesting!</p>
<p>Thanks for sharing!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Giorgio Sironi</title>
		<link>http://www.davegardner.me.uk/blog/2010/03/22/caching-dependency-injected-objects-with-php/comment-page-1/#comment-513</link>
		<dc:creator>Giorgio Sironi</dc:creator>
		<pubDate>Thu, 25 Mar 2010 18:25:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.davegardner.me.uk/blog/?p=89#comment-513</guid>
		<description>Maybe using setter injection instead of constructor injection you can reuse the same interface for a) injection of collaborators and b) waking up. I mean substituting the __construct() parameters with a few initXXX() methods which accept an object if the correspondent field property is not already set. After de-serialization the properties are null so the init*() methods work again.
Anyway, you shouldn&#039;t use methods that start with __. :) They are reserved for future use and convey a bad semantic (no magic behavior).</description>
		<content:encoded><![CDATA[<p>Maybe using setter injection instead of constructor injection you can reuse the same interface for a) injection of collaborators and b) waking up. I mean substituting the __construct() parameters with a few initXXX() methods which accept an object if the correspondent field property is not already set. After de-serialization the properties are null so the init*() methods work again.<br />
Anyway, you shouldn&#8217;t use methods that start with __. <img src='http://www.davegardner.me.uk/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  They are reserved for future use and convey a bad semantic (no magic behavior).</p>
]]></content:encoded>
	</item>
</channel>
</rss>

