[Dbix-class] Resultset with memcached
sindharta_tanuwijaya at yahoo.co.jp
sindharta_tanuwijaya at yahoo.co.jp
Wed Jan 9 01:01:24 GMT 2008
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 <Alexander.Hartmaier at t-systems.at> 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: sindharta_tanuwijaya at yahoo.co.jp [mailto:sindharta_tanuwijaya at yahoo.co.jp]
Sent: Tuesday, January 08, 2008 10:46 AM
To: dbix-class at lists.scsys.co.uk
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/dbix-class@lists.rawmode.org
---------------------------------
Easy + Joy + Powerful = Yahoo! Bookmarks x Toolbar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20080109/90f491c1/attachment.htm
More information about the DBIx-Class
mailing list