added some database cache tests while testing out a theory, the theory is busted, but at least we have some more tests

This commit is contained in:
JT Smith 2008-05-02 20:03:33 +00:00
parent 032d85c12d
commit 44c74c2299
2 changed files with 83 additions and 5 deletions

View file

@ -88,16 +88,15 @@ sub flush {
=head2 get ( )
Retrieve content from the filesystem cache.
Retrieve content from the database cache.
=cut
sub get {
my $self = shift;
return undef if ($self->session->config->get("disableCache"));
# getting better performance using native dbi than webgui sql
my $dbh = $self->session->db->dbh;
my $sth = $dbh->prepare("select content from cache where namespace=? and cachekey=? and expires>?");
my $session = $self->session;
return undef if ($session->config->get("disableCache"));
my $sth = $session->db->dbh->prepare("select content from cache where namespace=? and cachekey=? and expires>?");
$sth->execute($self->{_namespace},$self->{_key},time());
my $data = $sth->fetchrow_arrayref;
$sth->finish;