|
From: danny m. <dan...@gm...> - 2006-09-12 18:55:03
|
Hi list,
I am using DBD::mysql to connect to my db. I'm trying to cache my
already-executed statement handle ($sth) so i can reuse it over and
over again.
My code looks like this:
my $cache = Cache::FileCache->new();
my $sth = $cache->get_object(md5_hex($sql));
if (not defined $sth){
$sth = $dbh->prepare($sql);
$sth->execute();
$cache->set_object(md5_hex($sql),$sth);
}
while(my @r = $sth->fetchrow_array()) {....my loop.....}
.......the rest of my code......
And the error I get is:
Error: Can't store CODE items at P:/site/lib/Cache/CacheUtils.pm line 70.
Can someone give me an advise as to whether this is a right direction
I am going or how else can I accomplish such a mysql object caching.
Any comment would be appreciated.
Thanks,
Danny
|