Permalink
Browse files

Item11549: don't cache POSTs

git-svn-id: http://svn.foswiki.org/trunk@14066 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information...
MichaelDaum MichaelDaum
MichaelDaum authored and MichaelDaum committed Feb 23, 2012
1 parent 9864459 commit 9f920e2442bcad7d190a988180f25b5ae4f58c3e
Showing with 11 additions and 4 deletions.
  1. +11 −4 core/lib/Foswiki/PageCache.pm
@@ -357,12 +357,19 @@ sub isCacheable {
# by default we try to cache as much as possible
$isCacheable = 1;
# check prefs value
my $session = $Foswiki::Plugins::SESSION;
my $flag = $session->{prefs}->getPreference('CACHEABLE');
$isCacheable = 0 if defined $flag && !Foswiki::isTrue($flag);
# TODO: give plugins a chance - create a callback
# POSTs aren't cacheable
my $request = $session->{request};
$isCacheable = 0 if $request->method eq 'POST';
if ($isCacheable) {
# check prefs value
my $flag = $session->{prefs}->getPreference('CACHEABLE');
$isCacheable = 0 if defined $flag && !Foswiki::isTrue($flag);
}
# TODO: give plugins a chance - create a callback to intercept cacheability
writeDebug("isCacheable=$isCacheable");
$this->{isCacheable}{$webTopic} = $isCacheable;

0 comments on commit 9f920e2

Please sign in to comment.