<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sean&#039;s Blog &#187; caching</title>
	<atom:link href="http://seanbehan.com/tag/caching/feed/" rel="self" type="application/rss+xml" />
	<link>http://seanbehan.com</link>
	<description>Web Programming, Ruby on Rails, Wordpress, PHP from Burlington, Vermont</description>
	<lastBuildDate>Wed, 18 Jan 2012 21:44:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Link to jQuery Source from Google&#8217;s CDN</title>
		<link>http://seanbehan.com/front-end-development/link-to-jquery-source-from-googles-cdn/</link>
		<comments>http://seanbehan.com/front-end-development/link-to-jquery-source-from-googles-cdn/#comments</comments>
		<pubDate>Sat, 28 May 2011 17:09:44 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Front End Development]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[tips & snippets]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[cdn]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[page load]]></category>
		<category><![CDATA[speed]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=1324</guid>
		<description><![CDATA[https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js That is the link to the jQuery source hosted by Google on their CDN. It&#8217;s probably already cached on client machines so it should be as fast as is possible! You can read more/use other Javascript libs from Google&#8217;s CDN here: http://code.google.com/apis/libraries/devguide.html#jquery]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Ffront-end-development%2Flink-to-jquery-source-from-googles-cdn%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Link to jQuery Source from Google&#8217;s CDN" data-url="http://seanbehan.com/front-end-development/link-to-jquery-source-from-googles-cdn/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js</p>
<p>That is the link to the jQuery source hosted by Google on their CDN. It&#8217;s probably already cached on client machines so it should be as fast as is possible! You can read more/use other Javascript libs from Google&#8217;s CDN here: <a href="http://code.google.com/apis/libraries/devguide.html#jquery">http://code.google.com/apis/libraries/devguide.html#jquery</a></p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/front-end-development/link-to-jquery-source-from-googles-cdn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Use Pretty URLs with Rails will_paginate Plugin</title>
		<link>http://seanbehan.com/ruby-on-rails/how-to-use-pretty-urls-with-rails-will_paginate-plugin/</link>
		<comments>http://seanbehan.com/ruby-on-rails/how-to-use-pretty-urls-with-rails-will_paginate-plugin/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 01:43:54 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[routes]]></category>
		<category><![CDATA[urls]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=321</guid>
		<description><![CDATA[The will_paginate plugin for Rails uses a key/value assignment like ?page=2, rather than the pretty url formats such as /page/2 &#8230; This is because url generation and mapping are handled by the routes.rb file. You&#8217;ll need to modify the file so that rails knows what to do with request that match the pattern. Make sure [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fruby-on-rails%2Fhow-to-use-pretty-urls-with-rails-will_paginate-plugin%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="How to Use Pretty URLs with Rails will_paginate Plugin" data-url="http://seanbehan.com/ruby-on-rails/how-to-use-pretty-urls-with-rails-will_paginate-plugin/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>The will_paginate plugin for Rails uses a key/value assignment like ?page=2, rather than the pretty url formats such as /page/2 &#8230; This is because url generation and mapping are handled by the routes.rb file. You&#8217;ll need to modify the file so that rails knows what to do with request that match the pattern. Make sure to put the custom (map.connect) route before the normal restful routes (map.resources)</p>
<pre class="wp-code-highlight prettyprint">
map.connect '/topics/:id/page/:page', :controller =&gt; 'topics', :action =&gt; 'show'
map.resources :topics
</pre>
<p>Internally will_paginate uses the url_for method so Rails will now know how to construct your urls in a pretty way. I got most of this info from this discusson http://groups.google.com/group/will_paginate/browse_thread/thread/d0142b512cfca9d5?pli=1</p>
<p>There is nothing wrong leaving the default behavior alone and looking at the &#8216;ugly&#8217; key/value pairs in the address bar. However, if you take advantage of page caching in rails, you&#8217;ll need to do this anyway. Page caching in rails ignore extra parameters, any info before/after the &#8220;?&#8221; and &#8220;&#038;&#8221; symbols. There will be no difference from /topics/2?page=1 and /topics/2?page=100 in your cache. And since most likely the content will be very different on these two pages, you&#8217;ll need to have pretty urls so that page caching will save topics/2/page/1.html and topics/2/page/100.html as two different resources!</p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/ruby-on-rails/how-to-use-pretty-urls-with-rails-will_paginate-plugin/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Rails: Expiring a cached page with namespaces and sweepers</title>
		<link>http://seanbehan.com/ruby-on-rails/rails-expiring-a-cached-page-with-namespaces-and-sweepers/</link>
		<comments>http://seanbehan.com/ruby-on-rails/rails-expiring-a-cached-page-with-namespaces-and-sweepers/#comments</comments>
		<pubDate>Sun, 31 May 2009 18:55:35 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[production]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[Scaling]]></category>
		<category><![CDATA[sweeper]]></category>

		<guid isPermaLink="false">http://bseanvt.wordpress.com/?p=239</guid>
		<description><![CDATA[I&#8217;ve got some pages that are cached using their permalinks on the filesystem, such as http://example.com/about-us.html which will need to map to RAILS_ROOT/public/about-us.html &#8230; The issue I have is that I use a namespace for the admin area and the controllers in the namespace are responsible for expiring the cached pages, i.e., when the resources [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fruby-on-rails%2Frails-expiring-a-cached-page-with-namespaces-and-sweepers%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Rails: Expiring a cached page with namespaces and sweepers" data-url="http://seanbehan.com/ruby-on-rails/rails-expiring-a-cached-page-with-namespaces-and-sweepers/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>I&#8217;ve got some pages that are cached using their permalinks on the filesystem, such as http://example.com/about-us.html which will need to map to RAILS_ROOT/public/about-us.html &#8230; The issue I have is that I use a namespace for the admin area and the controllers in the namespace are responsible for expiring the cached pages, i.e., when the resources are updated by an admin.</p>
<p>Check out Rails Envy for a great tutorial for getting page caching set up: http://www.railsenvy.com/2007/2/28/rails-caching-tutorial</p>
<p>So what I want to do is expire the pages from inside my namespace. To accomplish this I need to use the pages route in my sweeper class.</p>
<pre class="wp-code-highlight prettyprint">
class PageSweeper &lt; ActionController::Caching::Sweeper
  #... after_save, after_destroy... we'll exprire the cache
  def expire_cache_for(record)
    #permalink rather than record id like /213.html
    expire_page(pages_path(record.permalink))
  end
end
</pre>
<p>Since I&#8217;m using a permalink to cache the page, I need to expire it with the permalink too.</p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/ruby-on-rails/rails-expiring-a-cached-page-with-namespaces-and-sweepers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

