new caching system
This commit is contained in:
parent
a15b5cb22d
commit
13b52b07f2
9 changed files with 281 additions and 187 deletions
|
|
@ -13,11 +13,31 @@ package Hourly::CleanFileCache;
|
|||
use strict;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Cache::FileCache;
|
||||
use File::Path;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my $cache = WebGUI::Cache::FileCache->new;
|
||||
$cache->shrink;
|
||||
traverse(WebGUI::Cache::FileCache->getCacheRoot);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub traverse {
|
||||
my $path = shift;
|
||||
if (opendir(DIR,$path)) {
|
||||
my @files = readdir(DIR);
|
||||
foreach my $file (@files) {
|
||||
unless ($file eq "." || $file eq "..") {
|
||||
if (open(FILE,"<".$path."/expires")) {
|
||||
my $expires = <FILE>;
|
||||
close(FILE);
|
||||
rmtree($path) if ($expires < time());
|
||||
} else {
|
||||
traverse($path."/".$file);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(DIR);
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -44,12 +44,12 @@ use HTML::Template ();
|
|||
use Parse::PlainConfig ();
|
||||
use Net::SMTP ();
|
||||
use Log::Log4perl ();
|
||||
use Cache::Cache ();
|
||||
use Tie::IxHash ();
|
||||
use Tie::CPHash ();
|
||||
use Time::HiRes ();
|
||||
use Date::Manip ();
|
||||
use Image::Magick ();
|
||||
use Storable;
|
||||
use XML::Simple ();
|
||||
|
||||
####
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ checkModule("Archive::Tar",1.05);
|
|||
checkModule("IO::Zlib",1.01);
|
||||
checkModule("Compress::Zlib",1.34);
|
||||
checkModule("Net::SMTP",2.24);
|
||||
checkModule("Cache::Cache",1.02);
|
||||
checkModule("Tie::IxHash",1.21);
|
||||
checkModule("Tie::CPHash",1.001);
|
||||
checkModule("XML::Simple",2.09);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue