2010-10-08 21:19:59 +02:00
|
|
|
#!/usr/bin/perl
|
|
|
|
#=============================================================================
|
2014-04-25 10:20:00 +02:00
|
|
|
# Cleaner for LemonLDAP::NG: purge local handler cache and session cache
|
2010-10-08 21:19:59 +02:00
|
|
|
#
|
2014-04-15 16:43:02 +02:00
|
|
|
# This module is written to be used by cron to clean cache objects used
|
|
|
|
# by Handler.
|
2010-10-08 21:19:59 +02:00
|
|
|
#
|
|
|
|
# This is part of LemonLDAP::NG product, released under GPL
|
|
|
|
#=============================================================================
|
|
|
|
|
|
|
|
use Lemonldap::NG::Common::Conf;
|
|
|
|
use Lemonldap::NG::Common::Conf::Constants;
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
my $debug = 0;
|
|
|
|
|
|
|
|
#=============================================================================
|
|
|
|
# Load configuration
|
|
|
|
#=============================================================================
|
|
|
|
my $lmconf = Lemonldap::NG::Common::Conf->new()
|
|
|
|
or die $Lemonldap::NG::Common::Conf::msg;
|
2012-08-13 12:01:59 +02:00
|
|
|
my $conf = $lmconf->getLocalConf(HANDLERSECTION)
|
2010-10-08 21:19:59 +02:00
|
|
|
or die "Unable to get local configuration ($!)";
|
|
|
|
|
|
|
|
print "Configuration loaded\n" if $debug;
|
2014-04-25 10:20:00 +02:00
|
|
|
|
|
|
|
# Handler cache
|
2010-10-08 21:19:59 +02:00
|
|
|
exit 0 unless ( $conf->{localStorage} );
|
|
|
|
eval "require $conf->{localStorage}";
|
|
|
|
$conf->{localStorageOptions}->{default_expires_in} ||= 600;
|
|
|
|
my $c = $conf->{localStorage}->new( $conf->{localStorageOptions} );
|
2012-08-13 12:01:59 +02:00
|
|
|
$c->purge();
|
2010-10-08 21:19:59 +02:00
|
|
|
|
2014-04-25 10:20:00 +02:00
|
|
|
# Session cache
|
|
|
|
exit 0 unless ( $conf->{localSessionStorage} );
|
|
|
|
eval "require $conf->{localSessionStorage}";
|
|
|
|
$conf->{localSessionStorageOptions}->{default_expires_in} ||= 600;
|
|
|
|
my $s = $conf->{localSessionStorage}->new( $conf->{localSessionStorageOptions} );
|
|
|
|
$s->purge();
|
|
|
|
|
2010-10-08 21:19:59 +02:00
|
|
|
exit 0;
|