lemonldap-ng/lemonldap-ng-handler/example/scripts/purgeLocalCache
François-Xavier Deltombe 203b4f5d9c Remove session cache default namespace from code also in purgeLocalCache
+ udpate comments (Lemonldap-499)
2012-08-13 10:53:29 +00:00

33 lines
1.2 KiB
Perl
Executable File

#!/usr/bin/perl
#=============================================================================
# Cleaner for LemonLDAP::NG: purge local handler cache
#
# This module is written to be used by cron to clean old sessions from
# Apache::Session. It does not works with Apache::Session::Memcached
#
# 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;
my $conf = $lmconf->getLocalConf(HANDLERSECTION)
or die "Unable to get local configuration ($!)";
print "Configuration loaded\n" if $debug;
exit 0 unless ( $conf->{localStorage} );
eval "require $conf->{localStorage}";
$conf->{localStorageOptions}->{default_expires_in} ||= 600;
my $c = $conf->{localStorage}->new( $conf->{localStorageOptions} );
$c->purge();
exit 0;