<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Rails expire_fragment(regex) Considered Harmful</title>
	<link>http://gurge.com/blog/2007/02/04/rails-expire_fragmentregex-considered-harmful/</link>
	<description></description>
	<pubDate>Thu, 20 Nov 2008 22:41:00 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
		<item>
		<title>By: Scott Lamb</title>
		<link>http://gurge.com/blog/2007/02/04/rails-expire_fragmentregex-considered-harmful/#comment-19948</link>
		<dc:creator>Scott Lamb</dc:creator>
		<pubDate>Sat, 17 Nov 2007 02:07:36 +0000</pubDate>
		<guid>http://gurge.com/blog/2007/02/04/rails-expire_fragmentregex-considered-harmful/#comment-19948</guid>
		<description>glob() is better than that but still not fast - it just gets all the directory entries and does an fnmatch() on each one.

On my ~1-year-old CentOS 5 Linux machine with warm cache, I just timed a non-matching glob() at 2 us per directory entry. Each unlink() also takes about 2 us. So that's an unnecessary 10 ms if you have 5,000 cache entries, or an unnecessary 200 ms if you have 100,000. Much better to just unlink() the entries that might be there than look at every entry first.</description>
		<content:encoded><![CDATA[<p>glob() is better than that but still not fast - it just gets all the directory entries and does an fnmatch() on each one.</p>
<p>On my ~1-year-old CentOS 5 Linux machine with warm cache, I just timed a non-matching glob() at 2 us per directory entry. Each unlink() also takes about 2 us. So that&#8217;s an unnecessary 10 ms if you have 5,000 cache entries, or an unnecessary 200 ms if you have 100,000. Much better to just unlink() the entries that might be there than look at every entry first.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ken</title>
		<link>http://gurge.com/blog/2007/02/04/rails-expire_fragmentregex-considered-harmful/#comment-2336</link>
		<dc:creator>Ken</dc:creator>
		<pubDate>Mon, 05 Mar 2007 19:34:50 +0000</pubDate>
		<guid>http://gurge.com/blog/2007/02/04/rails-expire_fragmentregex-considered-harmful/#comment-2336</guid>
		<description>Ruby does have a glob method in the Dir class:

http://www.ruby-doc.org/core/classes/Dir.html#M002374

Couldn't you just use that to get the list of files (hopefully quickly) and then call expire_fragment on the results?</description>
		<content:encoded><![CDATA[<p>Ruby does have a glob method in the Dir class:</p>
<p><a href="http://www.ruby-doc.org/core/classes/Dir.html#M002374" rel="nofollow">http://www.ruby-doc.org/core/classes/Dir.html#M002374</a></p>
<p>Couldn&#8217;t you just use that to get the list of files (hopefully quickly) and then call expire_fragment on the results?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ken</title>
		<link>http://gurge.com/blog/2007/02/04/rails-expire_fragmentregex-considered-harmful/#comment-2225</link>
		<dc:creator>Ken</dc:creator>
		<pubDate>Fri, 02 Mar 2007 20:39:47 +0000</pubDate>
		<guid>http://gurge.com/blog/2007/02/04/rails-expire_fragmentregex-considered-harmful/#comment-2225</guid>
		<description>Any way to force it to behave like glob instead of a stupid regex?  Unix solved making globbing fast about 30 years ago.</description>
		<content:encoded><![CDATA[<p>Any way to force it to behave like glob instead of a stupid regex?  Unix solved making globbing fast about 30 years ago.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
