<?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: Lazy proxy in Ruby	</title>
	<atom:link href="http://matteo.vaccari.name/blog/archives/333/feed" rel="self" type="application/rss+xml" />
	<link>http://matteo.vaccari.name/blog/archives/333</link>
	<description>Extreme enthusiasm</description>
	<lastBuildDate>
	Mon, 25 Feb 2019 15:18:16 +0000	</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.1.1</generator>
			<item>
				<title>
				By: matteo				</title>
				<link>http://matteo.vaccari.name/blog/archives/333/comment-page-1#comment-93109</link>
		<dc:creator><![CDATA[matteo]]></dc:creator>
		<pubDate>Wed, 17 Mar 2010 14:11:59 +0000</pubDate>
		<guid isPermaLink="false">http://matteo.vaccari.name/blog/?p=333#comment-93109</guid>
					<description><![CDATA[Hi Renzo,

thanks!  My reasoning is that the performance hit from erasing the cache every, say, 15m should not be that much.  And I like very much the peace of mind of knowing that, no matter what, the cache will not stay out-of-date for long.  

The downside is that the admin people will not be able to see their modification immediately and they might think the application is buggy.  Perhaps the best solution would be to use both cron job and after_update observer?]]></description>
		<content:encoded><![CDATA[<p>Hi Renzo,</p>
<p>thanks!  My reasoning is that the performance hit from erasing the cache every, say, 15m should not be that much.  And I like very much the peace of mind of knowing that, no matter what, the cache will not stay out-of-date for long.  </p>
<p>The downside is that the admin people will not be able to see their modification immediately and they might think the application is buggy.  Perhaps the best solution would be to use both cron job and after_update observer?</p>
]]></content:encoded>
						</item>
						<item>
				<title>
				By: Renzo				</title>
				<link>http://matteo.vaccari.name/blog/archives/333/comment-page-1#comment-93108</link>
		<dc:creator><![CDATA[Renzo]]></dc:creator>
		<pubDate>Wed, 17 Mar 2010 00:32:34 +0000</pubDate>
		<guid isPermaLink="false">http://matteo.vaccari.name/blog/?p=333#comment-93108</guid>
					<description><![CDATA[Elegant solution that works! 

I was thinking that maybe you&#039;re better off expiring the cache when a new product is added to the category instead of blindly let the cron doing it (unless you know categories are always updated at some point in time). You can use an after_update observer on the Category model, you can check if there are changes in the products association and invalidate the cache. If you do this, you don&#039;t need the lazy proxy. But as I said, it depends on the situation. Good luck!]]></description>
		<content:encoded><![CDATA[<p>Elegant solution that works! </p>
<p>I was thinking that maybe you&#8217;re better off expiring the cache when a new product is added to the category instead of blindly let the cron doing it (unless you know categories are always updated at some point in time). You can use an after_update observer on the Category model, you can check if there are changes in the products association and invalidate the cache. If you do this, you don&#8217;t need the lazy proxy. But as I said, it depends on the situation. Good luck!</p>
]]></content:encoded>
						</item>
						<item>
				<title>
				By: matteo				</title>
				<link>http://matteo.vaccari.name/blog/archives/333/comment-page-1#comment-93105</link>
		<dc:creator><![CDATA[matteo]]></dc:creator>
		<pubDate>Mon, 15 Mar 2010 13:15:32 +0000</pubDate>
		<guid isPermaLink="false">http://matteo.vaccari.name/blog/?p=333#comment-93105</guid>
					<description><![CDATA[Hi Paolo,

thanks for your comment.  I don&#039;t think there is a bug, as for every request a new proxy will be created.  Either that, or I misunderstand you :-)

It turns out, however, that the lazy proxy behaviour is now standard in Rails 3.  This technique might still be useful for Rails 2 though.]]></description>
		<content:encoded><![CDATA[<p>Hi Paolo,</p>
<p>thanks for your comment.  I don&#8217;t think there is a bug, as for every request a new proxy will be created.  Either that, or I misunderstand you :-)</p>
<p>It turns out, however, that the lazy proxy behaviour is now standard in Rails 3.  This technique might still be useful for Rails 2 though.</p>
]]></content:encoded>
						</item>
						<item>
				<title>
				By: Paolo "Nusco" Perrotta				</title>
				<link>http://matteo.vaccari.name/blog/archives/333/comment-page-1#comment-93104</link>
		<dc:creator><![CDATA[Paolo "Nusco" Perrotta]]></dc:creator>
		<pubDate>Mon, 15 Mar 2010 12:35:45 +0000</pubDate>
		<guid isPermaLink="false">http://matteo.vaccari.name/blog/?p=333#comment-93104</guid>
					<description><![CDATA[I love lazy proxies. :)
Your example, however, may contain a bug (either that, or I need more sleep): it only checks the :id parameter on the first call to category(). From the second time on, it still returns the @products for the first :id. Maybe you can use a hash to bind ids to products?

At that point, though, you basically have a cache that never expires. If you come up with ways to make it expire, then you&#039;ll be to be careful about race conditions again. This is not to detract from your very elegant solution - just be careful. :)]]></description>
		<content:encoded><![CDATA[<p>I love lazy proxies. :)<br />
Your example, however, may contain a bug (either that, or I need more sleep): it only checks the :id parameter on the first call to category(). From the second time on, it still returns the @products for the first :id. Maybe you can use a hash to bind ids to products?</p>
<p>At that point, though, you basically have a cache that never expires. If you come up with ways to make it expire, then you&#8217;ll be to be careful about race conditions again. This is not to detract from your very elegant solution &#8211; just be careful. :)</p>
]]></content:encoded>
						</item>
			</channel>
</rss>
