Hi,<br>
<br>
I am sorry, this is the correct code that I had. <br>
<br>
..<br>
..<br>
my $data;<br>
unless ( $data = $c->cache->get($cache_key) ) <br>
{<br>
$data =<br>
$c->master->resultset('table_name')->search( <br>
\%search_condition,<br>
) ->first;<br>
$c->cache->set( $cache_key, $data );<br>
}<br>
..<br>
..<br>
<br>
<div class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);" lang="EN-US">"So because the rs contains the db connection you can’t case it, only the result of it."</span></div><br>
<div class="MsoNormal">Let me check if I understand this statement. Are you saying that the results of the query are actually stored in the cache, but the db connection itself is not ? And, I am wondering where this error message came from.<br>
<span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);" lang="EN-US"><o:p></o:p></span></div> <span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);"
lang="EN-US"><o:p></o:p></span><br>
Couldn't render template "undef error - Can't call method "source" on an undefined value at /usr/lib/perl5/site_perl/5.8/DBIx/Class/ResultSourceHandle.pm line 64.<br>
<br>
I am using Catalyst with Template Toolkit by the way. It seems like a template error, but I haven't been able to figure it out. Any ideas ?<br>
<br>
Sindharta<br>
<br>
<b>Hartmaier Alexander <Alexander.Hartmaier@t-systems.at></b> wrote:<blockquote class="replbq" style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="Generator"
content="Microsoft Word 12 (filtered medium)"> <!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--> <style> <!-- /* Font Definitions */ @font-face
{font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4;} @font-face {font-family:Tahoma; panose-1:2 11 6 4 3 5 4 4 2 4;} @font-face {font-family:"MS PGothic"; panose-1:2 11 6 0 7 2 5 8 2 4;} @font-face {font-family:"\@MS
PGothic"; panose-1:2 11 6 0 7 2 5 8 2 4;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm; margin-bottom:.0001pt; font-size:12.0pt; font-family:"MS PGothic","sans-serif";} a:link, span.MsoHyperlink {mso-style-priority:99; color:blue;
text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {mso-style-priority:99; color:purple; text-decoration:underline;} p {mso-style-priority:99; mso-margin-top-alt:auto; margin-right:0cm; mso-margin-bottom-alt:auto; margin-left:0cm; font-size:12.0pt; font-family:"MS
PGothic","sans-serif";} span.E-MailFormatvorlage18 {mso-style-type:personal-reply; font-family:"Calibri","sans-serif"; color:#1F497D;} .MsoChpDefault {mso-style-type:export-only;} @page Section1 {size:612.0pt 792.0pt; margin:70.85pt 70.85pt 2.0cm 70.85pt;} div.Section1 {page:Section1;} -->
</style> <!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="1026" /> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1" /> </o:shapelayout></xml><![endif]--> <div class="Section1"> <div class="MsoNormal"><span
style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">Hi!<o:p></o:p></span></div> <div class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73,
125);"><o:p> </o:p></span></div> <div class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);" lang="EN-US">Where does $agent come from? I only see $date (which should me declared with my $date
btw).<o:p></o:p></span></div> <div class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);" lang="EN-US">Just for information, a resultset doesn’t contain any data, the sql is only generated and executed if you access the
rs by array or iterator (or ->first like in your case).<o:p></o:p></span></div> <div class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);" lang="EN-US">So because the rs contains the db connection you can’t case it,
only the result of it.<o:p></o:p></span></div> <div class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);" lang="EN-US"><o:p> </o:p></span></div> <div class="MsoNormal"><span style="font-size: 11pt; font-family:
"Calibri","sans-serif"; color: rgb(31, 73, 125);" lang="EN-US">-Alex<o:p></o:p></span></div> <div class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);" lang="EN-US"><o:p> </o:p></span></div>
<div style="border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; border-width: 1pt medium medium; padding: 3pt 0cm 0cm;"> <div class="MsoNormal"><b><span style="font-size: 10pt; font-family: "Tahoma","sans-serif";"
lang="DE">From:</span></b><span style="font-size: 10pt; font-family: "Tahoma","sans-serif";" lang="DE"> sindharta_tanuwijaya@yahoo.co.jp [mailto:sindharta_tanuwijaya@yahoo.co.jp] <br>
<b>Sent:</b> Tuesday, January 08, 2008 10:46 AM<br>
<b>To:</b> dbix-class@lists.scsys.co.uk<br>
<b>Subject:</b> [Dbix-class] Resultset with memcached<o:p></o:p></span></div> </div> <div class="MsoNormal"><o:p> </o:p></div> <div class="MsoNormal" style="margin-bottom: 12pt;">Hi,<br>
<br>
I am doing some experiments with memcached, hoping to make my web server faster, however I am wondering if we can use memcached together with DBIx::Class::Resultset ?<br>
<br>
My code is like this:<br>
..<br>
..<br>
unless ( $data = $c->cache->get($cache_key) ) <br>
{<br>
$date =<br>
$c->master->resultset('table_name')->search( <br>
\%search_condition,<br>
) ->first;<br>
$c->cache->set( $cache_key, $agent );<br>
}<br>
..<br>
..<br>
<br>
When it bypasses the connection to the database and gets the value from the cache, this error message appears:<br>
<br>
Couldn't render template "undef error - Can't call method "source" on an undefined value at /usr/lib/perl5/site_perl/5.8/DBIx/Class/ResultSourceHandle.pm line 64.<br>
<br>
I am assuming it has something to do with the database connection variables and stuff, but I am not really sure. Has anyone done any similar experiment ?<br>
<br>
Sindharta<br>
<br>
<o:p></o:p></div> <div> <div class="MsoNormal" style="line-height: 0%;"> <o:p></o:p></div> </div> <div> <o:p></o:p></div> <div class="MsoNormal" style="text-align: center;" align="center"> <hr align="center" size="1" width="100%"> </div> <div class="MsoNormal"><a
href="http://pr.mail.yahoo.co.jp/toolbar/" target="new">Easy + Joy + Powerful = Yahoo! Bookmarks x Toolbar</a><o:p></o:p></div> </div> _______________________________________________<br>
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class<br>
IRC: irc.perl.org#dbix-class<br>
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/<br>
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.rawmode.org</blockquote><br>
<div style="line-height: 0; width: 0; height: 5px; clear: both;"> </div>
<p> 
<hr size=1><a href=http://pr.mail.yahoo.co.jp/toolbar/ target="new">Easy + Joy + Powerful = Yahoo! Bookmarks x Toolbar</a><br>