diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index 3d9ae1fad..c8c86801a 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -845,26 +845,6 @@ sub getClassById { } -#------------------------------------------------------------------- - -=head2 getWwwCacheKey ( ) - -Returns a cache object specific to this asset, and whether or not the request is in SSL mode. - -=cut - -sub getWwwCacheKey { - my $self = shift; - my $session = $self->session; - my $method = shift; - my $cacheKey = join '_', @_, $self->getId; - if ($session->env->sslRequest) { - $cacheKey .= '_ssl'; - } - return $cacheKey; -} - - #------------------------------------------------------------------- =head2 getContainer ( ) @@ -883,6 +863,23 @@ sub getContainer { } } +#------------------------------------------------------------------- + +=head2 getContentLastModified + +Returns the overall modification time of the object and its content in Unix +epoch format, for the purpose of the Last-Modified HTTP header. Override this +for subclasses that contain content that is not solely lastModified property, +which gets updated every time update() is called. + +=cut + +sub getContentLastModified { + my $self = shift; + return $self->get("lastModified"); +} + + #------------------------------------------------------------------- =head2 getDefault ( session ) @@ -1711,18 +1708,34 @@ sub getUrl { #------------------------------------------------------------------- -=head2 getContentLastModified +=head2 getViewCacheKey ( ) -Returns the overall modification time of the object and its content in Unix -epoch format, for the purpose of the Last-Modified HTTP header. Override this -for subclasses that contain content that is not solely lastModified property, -which gets updated every time update() is called. +Returns the cache key for content generated by this Asset's view method. =cut -sub getContentLastModified { +sub getViewCacheKey { my $self = shift; - return $self->get("lastModified"); + return 'view_'.$self->assetId; +} + +#------------------------------------------------------------------- + +=head2 getWwwCacheKey ( ) + +Returns a cache object specific to this asset, and whether or not the request is in SSL mode. + +=cut + +sub getWwwCacheKey { + my $self = shift; + my $session = $self->session; + my $method = shift; + my $cacheKey = join '_', @_, $self->getId; + if ($session->env->sslRequest) { + $cacheKey .= '_ssl'; + } + return $cacheKey; } diff --git a/t/Asset/Asset.t b/t/Asset/Asset.t index ba5901b14..f88a910ca 100644 --- a/t/Asset/Asset.t +++ b/t/Asset/Asset.t @@ -35,7 +35,7 @@ my $session = WebGUI::Test->session; my @getTitleTests = getTitleTests($session); -plan tests => 110 +plan tests => 121 + 2*scalar(@getTitleTests) #same tests used for getTitle and getMenuTitle ;