<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Wed, 19 Jun 2013 07:02:32 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Vito Chin's Blog: Session-based object instantiation with memcached]]></title>
      <guid>http://www.phpdeveloper.org/news/12093</guid>
      <link>http://www.phpdeveloper.org/news/12093</link>
      <description><![CDATA[<p>
In <a href="http://vitochin.blogspot.com/2009/03/session-based-object-instantiation-with.html">this recent post</a> to his blog <i>Vito</i> looks at something that could say you and your application some hassle (and from some higher memory usage issues down the line) - memcaching objects as their instantiated.
</p>
<blockquote>
At runtime, a script sets up everything that it requires, allocating memory for variables and objects and all these gets torn down upon end of execution. There is no persistency beyond the notion of a session. [...] So, there will be lots of object construction and destruction going on while the user of a PHP web app goes about her business dealing with the same app. Here's where object caching with memcached helps.
</blockquote>
<p>
He suggests using memcache to cache and retrieve objects as they're needed instead of creating multiples over and over again. It almost functions as a <a href="http://en.wikipedia.org/wiki/Singleton_pattern">Singleton</a>, checking to see if there's already an object created before sending out a new one.
</p>]]></description>
      <pubDate>Mon, 09 Mar 2009 12:01:05 -0500</pubDate>
    </item>
  </channel>
</rss>
