fix lineage cache clearing, syntax warning, db cache storable usage

This commit is contained in:
Graham Knop 2008-11-04 22:47:11 +00:00
parent 7867ba61d5
commit 3cb07d4152
3 changed files with 4 additions and 5 deletions

View file

@ -122,7 +122,7 @@ sub cascadeLineage {
$cache->flush; $cache->flush;
} }
else { else {
my $descendants = $self->session->db->read("SELECT assetId FROM asset WHERE lineage LIKE ?", [$newLineage]); my $descendants = $self->session->db->read("SELECT assetId FROM asset WHERE lineage LIKE ?", [$newLineage . '%']);
while (my ($assetId, $lineage) = $descendants->array) { while (my ($assetId, $lineage) = $descendants->array) {
$cache->deleteChunk(["asset",$assetId]); $cache->deleteChunk(["asset",$assetId]);
} }

View file

@ -16,7 +16,7 @@ package WebGUI::Cache::Database;
use strict; use strict;
use base "WebGUI::Cache"; use base "WebGUI::Cache";
use Storable qw(freeze thaw); use Storable ();
=head1 NAME =head1 NAME
@ -104,7 +104,7 @@ sub get {
return undef unless ($content); return undef unless ($content);
# Storable doesn't like non-reference arguments, so we wrap it in a scalar ref. # Storable doesn't like non-reference arguments, so we wrap it in a scalar ref.
eval { eval {
$content = thaw($content); $content = Storable::thaw($content);
}; };
return undef unless $content && ref $content; return undef unless $content && ref $content;
return $$content; return $$content;
@ -175,7 +175,7 @@ The time to live for this content. This is the amount of time (in seconds) that
sub set { sub set {
my $self = shift; my $self = shift;
# Storable doesn't like non-reference arguments, so we wrap it in a scalar ref. # Storable doesn't like non-reference arguments, so we wrap it in a scalar ref.
my $content = freeze(\(scalar shift)); my $content = Storable::nfreeze(\(scalar shift));
my $ttl = shift || 60; my $ttl = shift || 60;
my $size = length($content); my $size = length($content);
# getting better performance using native dbi than webgui sql # getting better performance using native dbi than webgui sql

View file

@ -142,7 +142,6 @@ sub www_addFriendSave {
return $session->style->userStyle($output); return $session->style->userStyle($output);
} }
my $friends = WebGUI::Friends->new($session);
$friends->sendAddRequest($friendId, $session->form->get('comments')); $friends->sendAddRequest($friendId, $session->form->get('comments'));
# display result # display result