Converted all existing uses of cache.

This commit is contained in:
JT Smith 2009-09-25 22:24:33 -05:00
parent af705232a8
commit ccff9c7014
31 changed files with 108 additions and 144 deletions

View file

@ -31,7 +31,6 @@ use WebGUI::AssetVersioning;
use strict;
use Tie::IxHash;
use WebGUI::AdminConsole;
use WebGUI::Cache;
use WebGUI::Form;
use WebGUI::HTML;
use WebGUI::HTMLForm;
@ -1778,8 +1777,7 @@ sub new {
return undef unless $revisionDate;
}
my $cache = WebGUI::Cache->new($session, ["asset",$assetId,$revisionDate]);
my $properties = $cache->get;
my $properties = $session->cache->get(["asset",$assetId,$revisionDate]);
if (exists $properties->{assetId}) {
# got properties from cache
}
@ -2345,10 +2343,11 @@ sub publish {
my $idList = $self->session->db->quoteAndJoin($assetIds);
$self->session->db->write("update asset set state='published', stateChangedBy=".$self->session->db->quote($self->session->user->userId).", stateChanged=".$self->session->datetime->time()." where assetId in (".$idList.")");
my $cache = WebGUI::Cache->new($self->session);
foreach my $id (@{$assetIds}) {
# we do the purge directly cuz it's a lot faster than instantiating all these assets
$cache->deleteChunk(["asset",$id]);
my $asset = WebGUI::Asset->newByDynamicClass($self->session, $id);
if (defined $asset) {
$asset->purgeCache;
}
}
$self->{_properties}{state} = "published";
@ -2378,7 +2377,7 @@ sub purgeCache {
$stow->delete('assetLineage');
$stow->delete('assetClass');
$stow->delete('assetRevision');
WebGUI::Cache->new($self->session,["asset",$self->getId,$self->get("revisionDate")])->deleteChunk(["asset",$self->getId]);
$self->session->cache->delete(["asset",$self->getId,$self->get("revisionDate")]);
}