Skip to content

Commit

Permalink
Item12334: lots of performance improvements
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/DBCachePlugin@16347 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
MichaelDaum authored and MichaelDaum committed Jan 7, 2013
1 parent 16d3744 commit 4663e87
Show file tree
Hide file tree
Showing 6 changed files with 349 additions and 349 deletions.
18 changes: 14 additions & 4 deletions data/System/DBCachePlugin.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" date="1266412704" format="1.1" version="1.3"}%
%META:TOPICINFO{author="BaseUserMapping_999" comment="autosave" date="1356278770" format="1.1" version="4"}%
---+!! <nop>%TOPIC%
%TOC%

Expand Down Expand Up @@ -399,20 +399,30 @@ This option only has an effect using speedy/perperl or fastcgi setups.
When enabling =$$Foswiki::cfg{SecureTopicTitles}=, !TopicTitles will only be used as a link text in !WikiWords
when the user has got view access to the target topic.

---++ Plugin Installation Instructions
---++ Installation Instructions
%$INSTALL_INSTRUCTIONS%

<div class="foswikiWarningMessage">
WARNING: before using <nop>DBCachePlugin on your site do take down your web server and run

=cd <foswiki-root>/bin; ./rest /DBCachePlugin/updateCache=

to generate all caches initially. Then switch on the web server again. The cache will be maintained
automatically from there on.
</div>

---++ Plugin Info
<!--
* Set SHORTDESCRIPTION = Lightweight frontend to the <nop>DBCacheContrib
-->
| Author: | Michael Daum |
| Copyright &copy;: | 2005-2012, Michael Daum http://michaeldaumconsulting.com |
| Copyright &copy;: | 2005-2013, Michael Daum http://michaeldaumconsulting.com |
| License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) |
| Release: | %$RELEASE% |
| Version: | %$VERSION% |
| Change History: | <!-- versions below in reverse order -->&nbsp; |
29 Nov 2012: | topic title of webhomes now defaults to the web name instead of the topic name |
| 07 Jan 2013: | a lot of performance improvements |
| 29 Nov 2012: | topic title of webhomes now defaults to the web name instead of the topic name |
| 19 Nov 2012: | improved save performance on large webs |
| 01 Oct 2012: | handle bad date formfields more gracefully |
| 11 Jan 2012: | implemented !TopicTitles protected by access control rights |
Expand Down
36 changes: 28 additions & 8 deletions lib/Foswiki/Plugins/DBCachePlugin.pm
@@ -1,6 +1,6 @@
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/
#
# Copyright (C) 2005-2012 Michael Daum http://michaeldaumconsulting.com
# Copyright (C) 2005-2013 Michael Daum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand All @@ -22,8 +22,8 @@ use warnings;
#Monitor::MonitorMethod('Foswiki::Contrib::DBCachePlugin::Core');
#Monitor::MonitorMethod('Foswiki::Contrib::DBCachePlugin::WebDB');

our $VERSION = '4.30';
our $RELEASE = '4.30';
our $VERSION = '5.00';
our $RELEASE = '5.00';
our $NO_PREFS_IN_TOPIC = 1;
our $SHORTDESCRIPTION = 'Lightweighted frontend to the DBCacheContrib';

Expand Down Expand Up @@ -89,7 +89,7 @@ sub initPlugin {
return Foswiki::Plugins::DBCachePlugin::Core::handleTOPICTITLE(@_);
});

Foswiki::Func::registerRESTHandler('UpdateCache', \&restUpdateCache);
Foswiki::Func::registerRESTHandler('updateCache', \&restUpdateCache);

Foswiki::Func::registerRESTHandler('dbdump', sub {
initCore();
Expand Down Expand Up @@ -122,13 +122,28 @@ sub initCore {
}

###############################################################################
# REST handler to allow offline cache updates
# REST handler to create and update the dbcache
sub restUpdateCache {
my $session = shift;
my $web = $session->{webName};

my $db = getDB($web);
$db->load(1) if $db;
my $query = Foswiki::Func::getRequestObject();

my $theWeb = $query->param('web');
my @webs;

if ($theWeb) {
push @webs,$theWeb;
} else {
@webs = Foswiki::Func::getListOfWebs();
}

foreach my $web (sort @webs) {
print STDERR "### upating $web\n";
my $db = getDB($web);
$db->load(1) if $db;
}

return "### done\n\n";
}

###############################################################################
Expand Down Expand Up @@ -236,6 +251,11 @@ sub getDB {
return Foswiki::Plugins::DBCachePlugin::Core::getDB(@_);
}

sub unloadDB {
initCore();
return Foswiki::Plugins::DBCachePlugin::Core::unloadDB(@_);
}

sub getTopicTitle {
initCore();
return Foswiki::Plugins::DBCachePlugin::Core::getTopicTitle(@_);
Expand Down

0 comments on commit 4663e87

Please sign in to comment.