Hi,

I am sorry, this is the correct code that I had. 

..
 ..
    my $data;
     unless ( $data = $c->cache->get($cache_key) ) 
     {
       $data =
         $c->master->resultset('table_name')->search( 
           \%search_condition,
         ) ->first;
       $c->cache->set( $cache_key, $data );
     }
 ..
 ..
 
"So because the rs contains the db connection you can’t case it, only the 
result of it."

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.

  
 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.

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 ?

Sindharta
 
Hartmaier Alexander <[EMAIL PROTECTED]> wrote:         v\:* 
{behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* 
{behavior:url(#default#VML);} .shape {behavior:url(#default#VML);}              
       Hi!
   
  Where does $agent come from? I only see $date (which should me declared with 
my $date btw).
  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).
  So because the rs contains the db connection you can’t case it, only the 
result of it.
   
  -Alex
   
    From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, January 08, 2008 10:46 AM
 To: [email protected]
 Subject: [Dbix-class] Resultset with memcached
  
   
  Hi,
 
 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 ?
 
 My code is like this:
 ..
 ..
     unless ( $data = $c->cache->get($cache_key) ) 
     {
       $date =
         $c->master->resultset('table_name')->search( 
           \%search_condition,
         ) ->first;
       $c->cache->set( $cache_key, $agent );
     }
 ..
 ..
 
 When it bypasses the connection to the database and gets the value from the 
cache, this error message appears:
 
 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.
 
 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 ?
 
 Sindharta
 
 
     
  
    
    
---------------------------------
  
  Easy + Joy + Powerful = Yahoo! Bookmarks x Toolbar
  
  _______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]
 

 
---------------------------------
Easy + Joy + Powerful = Yahoo! Bookmarks x Toolbar
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]

Reply via email to