Add a method for getViewCacheKey. Update number of tests.

This commit is contained in:
Colin Kuskie 2010-05-09 19:03:20 -07:00
parent 95fe1e6d52
commit 923e03f048
2 changed files with 41 additions and 28 deletions

View file

@ -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;
}

View file

@ -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
;