<?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: symfony cache system: cache growing too large</title>
	<atom:link href="http://stereointeractive.com/blog/2009/04/10/symfony-cache-system-cache-growing-too-large/feed/" rel="self" type="application/rss+xml" />
	<link>http://stereointeractive.com/blog/2009/04/10/symfony-cache-system-cache-growing-too-large/</link>
	<description>Development Blog</description>
	<lastBuildDate>Thu, 17 Nov 2011 00:02:13 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Scott Meves</title>
		<link>http://stereointeractive.com/blog/2009/04/10/symfony-cache-system-cache-growing-too-large/comment-page-1/#comment-762</link>
		<dc:creator>Scott Meves</dc:creator>
		<pubDate>Mon, 14 Nov 2011 18:35:21 +0000</pubDate>
		<guid isPermaLink="false">http://stereointeractive.com/blog/?p=193#comment-762</guid>
		<description>I would suggest turning off caching of any user-context cache. The savings you get from just one individual user revising their own profile during the time when the cache is fresh probably isn&#039;t worth it. Instead, you might want to look into APC or caching your query results rather than the actual html templates.</description>
		<content:encoded><![CDATA[<p>I would suggest turning off caching of any user-context cache. The savings you get from just one individual user revising their own profile during the time when the cache is fresh probably isn&#8217;t worth it. Instead, you might want to look into APC or caching your query results rather than the actual html templates.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: EP Factory</title>
		<link>http://stereointeractive.com/blog/2009/04/10/symfony-cache-system-cache-growing-too-large/comment-page-1/#comment-761</link>
		<dc:creator>EP Factory</dc:creator>
		<pubDate>Mon, 14 Nov 2011 16:44:53 +0000</pubDate>
		<guid isPermaLink="false">http://stereointeractive.com/blog/?p=193#comment-761</guid>
		<description>Hi,
I&#039;m creating a social network with 10 cultures and I have to configure the symfony cache. So I use the contextual cache with parameters (sf_culture, slug...) to cache each user page (there are more than 2000 users). But in less than 4 hours, cache folder is more than 1.5 Go !
Do you know an alternative to symfony cache when contextual cache is not sufficient ?
Thank you</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I&#8217;m creating a social network with 10 cultures and I have to configure the symfony cache. So I use the contextual cache with parameters (sf_culture, slug&#8230;) to cache each user page (there are more than 2000 users). But in less than 4 hours, cache folder is more than 1.5 Go !<br />
Do you know an alternative to symfony cache when contextual cache is not sufficient ?<br />
Thank you</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Meves</title>
		<link>http://stereointeractive.com/blog/2009/04/10/symfony-cache-system-cache-growing-too-large/comment-page-1/#comment-623</link>
		<dc:creator>Scott Meves</dc:creator>
		<pubDate>Fri, 24 Sep 2010 16:38:06 +0000</pubDate>
		<guid isPermaLink="false">http://stereointeractive.com/blog/?p=193#comment-623</guid>
		<description>Thanks Lawrence, I think you are right! I have updated the post.</description>
		<content:encoded><![CDATA[<p>Thanks Lawrence, I think you are right! I have updated the post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lawrence Krubner</title>
		<link>http://stereointeractive.com/blog/2009/04/10/symfony-cache-system-cache-growing-too-large/comment-page-1/#comment-622</link>
		<dc:creator>Lawrence Krubner</dc:creator>
		<pubDate>Fri, 24 Sep 2010 16:21:48 +0000</pubDate>
		<guid isPermaLink="false">http://stereointeractive.com/blog/?p=193#comment-622</guid>
		<description>Back on Jun 6, 2009 I pointed out a typo that you&#039;ve since corrected. But what about the yaml example that follows? You have:

_searchTop:
  enabled:     on
  contextual:  false

Where does this _searchTop come from? This is the first mention of _searchTop on the page. Is this a typo? Should it be _headerNav?

Anyway, this is a great post. I was just showing it to a co-worker.</description>
		<content:encoded><![CDATA[<p>Back on Jun 6, 2009 I pointed out a typo that you&#8217;ve since corrected. But what about the yaml example that follows? You have:</p>
<p>_searchTop:<br />
  enabled:     on<br />
  contextual:  false</p>
<p>Where does this _searchTop come from? This is the first mention of _searchTop on the page. Is this a typo? Should it be _headerNav?</p>
<p>Anyway, this is a great post. I was just showing it to a co-worker.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robin Corps</title>
		<link>http://stereointeractive.com/blog/2009/04/10/symfony-cache-system-cache-growing-too-large/comment-page-1/#comment-528</link>
		<dc:creator>Robin Corps</dc:creator>
		<pubDate>Thu, 18 Feb 2010 14:25:12 +0000</pubDate>
		<guid isPermaLink="false">http://stereointeractive.com/blog/?p=193#comment-528</guid>
		<description>In Symfony 1.2 (at least) you can do the following to clear cache cross application from within an action (eg. clear frontend cache from backend app):

$configuration =  ProjectConfiguration::getApplicationConfiguration(&#039;frontend&#039;, sfContext::getInstance()-&gt;getConfiguration()-&gt;getEnvironment(), false);
$context = sfContext::createInstance($configuration);
$cache_manager = $context-&gt;getViewCacheManager();
$cache_manager-&gt;remove(&#039;@sf_cache_partial?module=[your_module]&amp;action=[your_action]&amp;sf_cache_key=[your_id]&#039;);

This example would clear a given partial in the frontend app from the backend app.

Hope that helps someone!
Robin</description>
		<content:encoded><![CDATA[<p>In Symfony 1.2 (at least) you can do the following to clear cache cross application from within an action (eg. clear frontend cache from backend app):</p>
<p>$configuration =  ProjectConfiguration::getApplicationConfiguration(&#8216;frontend&#8217;, sfContext::getInstance()-&gt;getConfiguration()-&gt;getEnvironment(), false);<br />
$context = sfContext::createInstance($configuration);<br />
$cache_manager = $context-&gt;getViewCacheManager();<br />
$cache_manager-&gt;remove(&#8216;@sf_cache_partial?module=[your_module]&amp;action=[your_action]&amp;sf_cache_key=[your_id]&#8216;);</p>
<p>This example would clear a given partial in the frontend app from the backend app.</p>
<p>Hope that helps someone!<br />
Robin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nei Rauni Santos</title>
		<link>http://stereointeractive.com/blog/2009/04/10/symfony-cache-system-cache-growing-too-large/comment-page-1/#comment-466</link>
		<dc:creator>Nei Rauni Santos</dc:creator>
		<pubDate>Thu, 13 Aug 2009 20:58:50 +0000</pubDate>
		<guid isPermaLink="false">http://stereointeractive.com/blog/?p=193#comment-466</guid>
		<description>Hi, I&#039;m trying to show the cache datetime on my template. can you help me?

on my action I do it:

&lt;code&gt;
$cacheManager = $this-&gt;getContext()-&gt;getViewCacheManager();
    $component_uri = &quot;@sf_cache_partial?module=dashboard&amp;action=_translations&amp;sf_cache_key=40cd750bba9870f18aada2478b24840a&quot;;
    
    $this-&gt;lastModified = $cacheManager-&gt;getLastModified( $component_uri );
    $this-&gt;lifetime = $cacheManager-&gt;getLifetime( $component_uri );
&lt;/code&gt;

and on my template I did it:
&lt;code&gt;
 
 this cache was generated at , next update will be in  seconds
&lt;/code&gt;

I worked fine, but the variable sf_cache_key=40cd750bba9870f18aada2478b24840a&quot; is hardcoded, how can I get this key dinamicaly??

thank you,

Nei</description>
		<content:encoded><![CDATA[<p>Hi, I&#8217;m trying to show the cache datetime on my template. can you help me?</p>
<p>on my action I do it:</p>
<p><code><br />
$cacheManager = $this-&gt;getContext()-&gt;getViewCacheManager();<br />
    $component_uri = "@sf_cache_partial?module=dashboard&amp;action=_translations&amp;sf_cache_key=40cd750bba9870f18aada2478b24840a";</p>
<p>    $this-&gt;lastModified = $cacheManager-&gt;getLastModified( $component_uri );<br />
    $this-&gt;lifetime = $cacheManager-&gt;getLifetime( $component_uri );<br />
</code></p>
<p>and on my template I did it:<br />
<code></p>
<p> this cache was generated at , next update will be in  seconds<br />
</code></p>
<p>I worked fine, but the variable sf_cache_key=40cd750bba9870f18aada2478b24840a&#8221; is hardcoded, how can I get this key dinamicaly??</p>
<p>thank you,</p>
<p>Nei</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Meves</title>
		<link>http://stereointeractive.com/blog/2009/04/10/symfony-cache-system-cache-growing-too-large/comment-page-1/#comment-425</link>
		<dc:creator>Scott Meves</dc:creator>
		<pubDate>Sat, 06 Jun 2009 18:33:27 +0000</pubDate>
		<guid isPermaLink="false">http://stereointeractive.com/blog/?p=193#comment-425</guid>
		<description>You&#039;re right about the typo, thank you!

A cron job would work well for the cases where you end up with lots of old cache files sitting around; symfony won&#039;t delete them until they need them again and see they are too old. But, it doesn&#039;t fix the case where an object from your model is modified and you don&#039;t those old cached files lingering around between the time it was modified and the time the cron script runs. For example, if you had a blog post and you cached the blog/show?id=xx view, and then you made an edit to the blog post content, you&#039;d want to see your edits right away and not wait until your cache file reached the age limit. 

So, the core of the issue is this: You need some way to link modifications of your model objects to a list of cached files that are affected by the change. As long as you listen in to when the object is modified, you can move the actual list of which files are modified out of the model and into some other class or even listener so keep your MVC components clean.</description>
		<content:encoded><![CDATA[<p>You&#8217;re right about the typo, thank you!</p>
<p>A cron job would work well for the cases where you end up with lots of old cache files sitting around; symfony won&#8217;t delete them until they need them again and see they are too old. But, it doesn&#8217;t fix the case where an object from your model is modified and you don&#8217;t those old cached files lingering around between the time it was modified and the time the cron script runs. For example, if you had a blog post and you cached the blog/show?id=xx view, and then you made an edit to the blog post content, you&#8217;d want to see your edits right away and not wait until your cache file reached the age limit. </p>
<p>So, the core of the issue is this: You need some way to link modifications of your model objects to a list of cached files that are affected by the change. As long as you listen in to when the object is modified, you can move the actual list of which files are modified out of the model and into some other class or even listener so keep your MVC components clean.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lawrence Krubner</title>
		<link>http://stereointeractive.com/blog/2009/04/10/symfony-cache-system-cache-growing-too-large/comment-page-1/#comment-424</link>
		<dc:creator>Lawrence Krubner</dc:creator>
		<pubDate>Sat, 06 Jun 2009 18:12:50 +0000</pubDate>
		<guid isPermaLink="false">http://stereointeractive.com/blog/?p=193#comment-424</guid>
		<description>I am curious, wouldn&#039;t it be easier to write a cron that lives outside of Symfony (or maybe do this as a task) and which periodically sweeps through the cache and deletes any file that is older than a certain period? That would cut down on those files that arise simply because of some random search that someone did 4 months ago. Like David, above, I&#039;m uncomfortable having the model classes know about specific partials. That seems like a major violation of MVC principles. 

By the way, you write: 

&quot;&lt;i&gt;say this partial is in our app’s layout folder  and is called _headerNav.php.
&lt;?php include_partial(&#039;global/searchTop&#039;) ?&gt;&lt;/i&gt;&quot;

Is that a typo? Shouldn&#039;t it be &quot;headerNav&quot;?</description>
		<content:encoded><![CDATA[<p>I am curious, wouldn&#8217;t it be easier to write a cron that lives outside of Symfony (or maybe do this as a task) and which periodically sweeps through the cache and deletes any file that is older than a certain period? That would cut down on those files that arise simply because of some random search that someone did 4 months ago. Like David, above, I&#8217;m uncomfortable having the model classes know about specific partials. That seems like a major violation of MVC principles. </p>
<p>By the way, you write: </p>
<p>&#8220;<i>say this partial is in our app’s layout folder  and is called _headerNav.php.<br />
&lt;?php include_partial(&#8216;global/searchTop&#8217;) ?&gt;</i>&#8221;</p>
<p>Is that a typo? Shouldn&#8217;t it be &#8220;headerNav&#8221;?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Colin</title>
		<link>http://stereointeractive.com/blog/2009/04/10/symfony-cache-system-cache-growing-too-large/comment-page-1/#comment-416</link>
		<dc:creator>Colin</dc:creator>
		<pubDate>Mon, 04 May 2009 18:02:20 +0000</pubDate>
		<guid isPermaLink="false">http://stereointeractive.com/blog/?p=193#comment-416</guid>
		<description>I couldn&#039;t help but notice nobody has mentioned the auto cleaning factor

http://trac.symfony-project.org/browser/branches/1.0/lib/cache/sfFileCache.class.php#L73

Could be that the only documentation of this setting is the source code itself :P

- CH</description>
		<content:encoded><![CDATA[<p>I couldn&#8217;t help but notice nobody has mentioned the auto cleaning factor</p>
<p><a href="http://trac.symfony-project.org/browser/branches/1.0/lib/cache/sfFileCache.class.php#L73" rel="nofollow">http://trac.symfony-project.org/browser/branches/1.0/lib/cache/sfFileCache.class.php#L73</a></p>
<p>Could be that the only documentation of this setting is the source code itself <img src='http://stereointeractive.com/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>- CH</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://stereointeractive.com/blog/2009/04/10/symfony-cache-system-cache-growing-too-large/comment-page-1/#comment-407</link>
		<dc:creator>David</dc:creator>
		<pubDate>Tue, 21 Apr 2009 11:47:33 +0000</pubDate>
		<guid isPermaLink="false">http://stereointeractive.com/blog/?p=193#comment-407</guid>
		<description>@Scott: using the symfony event notification system for this is exactly what I&#039;d also propose. Yet another configuration file for the caches is probably a solution, but I would prefer something a little less redundant.

What about placing some kind of comment (like PHPDoc) at the beginning of each template, stating what objects are used inside this template? Of course this has to be kept up-to-date as well, but it&#039;s much easier IMHO than having this in a different file. And there would be one more advantage: if you remove the template, the system won&#039;t try to remove its cache any more. So you are more able to re-use stuff as long as you use the same cache cleanup mechanism everywhere.</description>
		<content:encoded><![CDATA[<p>@Scott: using the symfony event notification system for this is exactly what I&#8217;d also propose. Yet another configuration file for the caches is probably a solution, but I would prefer something a little less redundant.</p>
<p>What about placing some kind of comment (like PHPDoc) at the beginning of each template, stating what objects are used inside this template? Of course this has to be kept up-to-date as well, but it&#8217;s much easier IMHO than having this in a different file. And there would be one more advantage: if you remove the template, the system won&#8217;t try to remove its cache any more. So you are more able to re-use stuff as long as you use the same cache cleanup mechanism everywhere.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

