[Catalyst-commits] r13708 - trunk/examples/CatalystAdvent/root/2010/pen

skaufman at dev.catalyst.perl.org skaufman at dev.catalyst.perl.org
Mon Nov 22 16:43:26 GMT 2010


Author: skaufman
Date: 2010-11-22 16:43:26 +0000 (Mon, 22 Nov 2010)
New Revision: 13708

Added:
   trunk/examples/CatalystAdvent/root/2010/pen/memcached-dbix-class.pod
Removed:
   trunk/examples/CatalystAdvent/root/2010/pen/memcached-dbix-class.html
Log:
first pass at converting to pod

Deleted: trunk/examples/CatalystAdvent/root/2010/pen/memcached-dbix-class.html
===================================================================
--- trunk/examples/CatalystAdvent/root/2010/pen/memcached-dbix-class.html	2010-11-22 16:11:37 UTC (rev 13707)
+++ trunk/examples/CatalystAdvent/root/2010/pen/memcached-dbix-class.html	2010-11-22 16:43:26 UTC (rev 13708)
@@ -1,103 +0,0 @@
-This tutorial will show you how to:
-<ul>
-    <li>Easily add resultset level caching to your <a href="http://search.cpan.org/perldoc?Catalyst%3A%3AModel%3A%3ADBIC%3A%3ASchema">Catalyst::Model::DBIC::Schema</a> calls.</li>
-    <li>Move your <a href="http://search.cpan.org/perldoc?Catalyst%3A%3APlugin%3A%3ASession">Catalyst::Plugin::Session</a> into memcached.</li>
-    <li>Have a convenient $ctx-&gt;cache method available for anything else you might want to cache.</li>
-</ul>
-<strong>Dependencies:</strong><br/>
-Memcached:
-<ul>
-<li><a href="http://search.cpan.org/perldoc?Cache%3A%3AMemcached">Cache::Memcached</a></li>
-<li><a href="http://search.cpan.org/perldoc?Cache%3A%3AMemcached%3A%3AGetParserXS">Cache::Memcached::GetParserXS</a></li>
-</ul>
-Catalyst Plugins:
-<ul>
-<li><a href="http://search.cpan.org/perldoc?Catalyst%3A%3APlugin%3A%3AConfigLoader">Catalyst::Plugin::ConfigLoader</a></li>
-<li><a href="http://search.cpan.org/perldoc?Catalyst%3A%3APlugin%3A%3ASession">Catalyst::Plugin::Session</a></li>
-<li><a href="http://search.cpan.org/perldoc?Catalyst%3A%3APlugin%3A%3ACache">Catalyst::Plugin::Cache</a></li>
-<li><a href="http://search.cpan.org/perldoc?Catalyst%3A%3APlugin%3A%3ASession%3A%3AStore%3A%3ACache">Catalyst::Plugin::Session::Store::Cache</a></li>
-</ul>
-DBIx::Class:
-<ul>
-<li><a href="http://search.cpan.org/perldoc?DBIx%3A%3AClass%3A%3ACursor%3A%3ACached">DBIx::Class::Cursor::Cached</a></li>
-</ul>
-
-<p>So dump all those in your Makefile.PL and you're halfway there.</p>
-<p>First we edit your Catalyst app's base package. Open up your version of MyApp.pm and add:</p>
-<p>
-<pre>
-
-    use Cache::Memcached::GetParserXS;
-    use Cache::Memcached;
-
-</pre>
-</p>
-<p>This will tell Cache::Memcached to use the XS Parser.</p>
-<p>
-Now, in the section where you load your plugins, add the new ones in:
-<pre>
-
-    use Catalyst qw/
-        ConfigLoader
-        Session
-        Cache
-        Session::Store::Cache
-    /;
-
-</pre>
-</p>
-<br/>
-</p>
-
-<p>Now, configure Catalyst::Plugin::Cache. Here's an example for etc/myapp_local.pl:</p>
-<br/>
-<pre>
-
-    #!/usr/bin/env perl
-    use strict;
-    use warnings;
-    return {
-        'Plugin::Cache' =&gt; {
-            backend =&gt; {
-                namespace           =&gt;  'myapp:',
-                class               =&gt;  'Cache::Memcached',
-                servers             =&gt; [ 'dev:11211' ]
-            }
-        }
-    };
-
-</pre>
-<br/>
-<p>Note, I didn't use a .pl config just for kicks. Notice how the 'servers' param takes an ArrayRef value. I tried and failed in expressing that in our Apache Conf style config, before realizing that ConfigLoader is just as happy to grab your .pl config alongside your regular config and merge them for you. Sometimes a cop-out is better than a hack.</p> 
-<br/>
-<p>Now we configure our model. In our apache style conf it would look like this:</p>
-<pre>
-
-    &lt;Model::MyAppDB&gt;
-        schema_class    MyApp::Schema
-        &lt;connect_info&gt;
-            (your connect_info)
-            cursor_class    DBIx::Class::Cursor::Cached
-            traits          Caching
-        &lt;/connect_info&gt;
-    &lt;/Model::MyAppDB&gt;
-
-</pre>
-
-<p>Pat yourself on the back, you should be done (unless something went horribly wrong).</p>
-<p>
-<pre>
-
-    my @sweet_loot = $ctx-&gt;model("MyAppDB::Loot")-&gt;search({ sweet =&gt; 1 },{ cache_for =&gt; 300 })-&gt;all;
-
-</pre>
-<p>That $rs is now cached for 300 seconds. Look at <a href="http://search.cpan.org/perldoc?DBIx%3A%3AClass%3A%3ACursor%3A%3ACached">DBIx::Class::Cursor::Cached</a> for further explanation.
-
-<pre>
-
-    my $cache = $ctx-&gt;cache;
-    $cache-&gt;set('turtles',{ ilike =&gt; 'turtles' },600);
-    my $do_i_like_turtles = $cache-&gt;get('turtles');
-
-</pre>
-<p>That's cached for 600 seconds. See <a href="http://search.cpan.org/perldoc?Catalyst%3A%3APlugin%3A%3ACache">Catalyst::Plugin::Cache</a> for the docs.</p>

Added: trunk/examples/CatalystAdvent/root/2010/pen/memcached-dbix-class.pod
===================================================================
--- trunk/examples/CatalystAdvent/root/2010/pen/memcached-dbix-class.pod	                        (rev 0)
+++ trunk/examples/CatalystAdvent/root/2010/pen/memcached-dbix-class.pod	2010-11-22 16:43:26 UTC (rev 13708)
@@ -0,0 +1,141 @@
+=pod
+
+This tutorial will show you how to:
+
+=over
+
+=item * Easily add resultset level caching to your
+Catalyst::Model::DBIC::Schema
+(http://search.cpan.org/perldoc?Catalyst%3A%3AModel%3A%3ADBIC%3A%3ASchema)
+calls.
+
+=item * Move your Catalyst::Plugin::Session
+(http://search.cpan.org/perldoc?Catalyst%3A%3APlugin%3A%3ASession) into
+memcached.
+
+=item * Have a convenient $ctx-E<gt>cache method available for anything
+else you might want to cache.
+
+=back
+
+B<Dependencies:>
+
+Memcached:
+
+=over
+
+=item * Cache::Memcached
+(http://search.cpan.org/perldoc?Cache%3A%3AMemcached)
+
+=item * Cache::Memcached::GetParserXS
+(http://search.cpan.org/perldoc?Cache%3A%3AMemcached%3A%3AGetParserXS)
+
+=back
+
+Catalyst Plugins:
+
+=over
+
+=item * Catalyst::Plugin::ConfigLoader
+(http://search.cpan.org/perldoc?Catalyst%3A%3APlugin%3A%3AConfigLoader)
+
+=item * Catalyst::Plugin::Session
+(http://search.cpan.org/perldoc?Catalyst%3A%3APlugin%3A%3ASession)
+
+=item * Catalyst::Plugin::Cache
+(http://search.cpan.org/perldoc?Catalyst%3A%3APlugin%3A%3ACache)
+
+=item * Catalyst::Plugin::Session::Store::Cache
+(http://search.cpan.org/perldoc?Catalyst%3A%3APlugin%3A%3ASession%3A%3AStore%3A%3ACache)
+
+=back
+
+DBIx::Class:
+
+=over
+
+=item * DBIx::Class::Cursor::Cached
+(http://search.cpan.org/perldoc?DBIx%3A%3AClass%3A%3ACursor%3A%3ACached)
+
+=back
+
+So dump all those in your Makefile.PL and you're halfway there.
+
+First we edit your Catalyst app's base package. Open up your version of
+MyApp.pm and add:
+
+    use Cache::Memcached::GetParserXS;
+    use Cache::Memcached;
+
+This will tell Cache::Memcached to use the XS Parser.
+
+Now, in the section where you load your plugins, add the new ones in:
+
+    use Catalyst qw/
+        ConfigLoader
+        Session
+        Cache
+        Session::Store::Cache
+    /;
+
+Now, configure Catalyst::Plugin::Cache. Here's an example for
+etc/myapp_local.pl:
+
+    #!/usr/bin/env perl
+    use strict;
+    use warnings;
+    return {
+        'Plugin::Cache' => {
+            backend => {
+                namespace           =>  'myapp:',
+                class               =>  'Cache::Memcached',
+                servers             => [ 'dev:11211' ]
+            }
+        }
+    };
+
+Note, I didn't use a .pl config just for kicks. Notice how the
+'servers' param takes an ArrayRef value. I tried and failed in
+expressing that in our Apache Conf style config, before realizing that
+ConfigLoader is just as happy to grab your .pl config alongside your
+regular config and merge them for you. Sometimes a cop-out is better
+than a hack.
+
+Now we configure our model. In our apache style conf it would look like
+this:
+
+    <Model::MyAppDB>
+        schema_class    MyApp::Schema
+        <connect_info>
+            (your connect_info)
+            cursor_class    DBIx::Class::Cursor::Cached
+            traits          Caching
+        </connect_info>
+    </Model::MyAppDB>
+
+Pat yourself on the back, you should be done (unless something went
+horribly wrong).
+
+    my @sweet_loot = $ctx->model("MyAppDB::Loot")->search({ sweet => 1 },{ cache_for => 300 })->all;
+
+That $rs is now cached for 300 seconds. Look at
+DBIx::Class::Cursor::Cached
+(http://search.cpan.org/perldoc?DBIx%3A%3AClass%3A%3ACursor%3A%3ACached)
+for further explanation.
+
+    my $cache = $ctx->cache;
+    $cache->set('turtles',{ ilike => 'turtles' },600);
+    my $do_i_like_turtles = $cache->get('turtles');
+
+That's cached for 600 seconds. See Catalyst::Plugin::Cache
+(http://search.cpan.org/perldoc?Catalyst%3A%3APlugin%3A%3ACache) for
+the docs.
+
+=cut
+
+#Pod::HTML2Pod conversion notes:
+#From file memcached-dbix-class.html
+# 3884 bytes of input
+#Mon Nov 22 16:40:36 2010 skaufman
+# No a_name switch not specified, so will not try to render <a name='...'>
+# Will try to render <a href='...'>




More information about the Catalyst-commits mailing list