CGI-Session-Driver-redis
view release on metacpan or search on metacpan
lib/CGI/Session/Driver/redis.pm view on Meta::CPAN
{
my $self = shift;
# NOP
}
=head2 traverse
Invoke the specified code reference on each active session.
This is required to allow this driver to be used with the L<CGI::Session/find> method.
=cut
sub traverse
{
my $self = shift;
my ($coderef) = @_;
unless ( $coderef && ref($coderef) && ( ref $coderef eq 'CODE' ) )
{
croak "traverse(): usage error";
}
my $prefix = $self->{ 'Prefix' } || "session";
my $key = $prefix . ':members';
#
# Redis doesn't like to have whitespace in the keys.
#
$key =~ s/\s//g;
#
# For each key invoke the callback.
#
foreach my $session ( $self->{ 'Redis' }->smembers($key) )
{
$coderef->($session);
}
return 1;
}
1;
=head1 SEE ALSO
=over 4
=item *
L<CGI::Session|CGI::Session> - CGI::Session manual
=item *
L<CGI::Session::Tutorial|CGI::Session::Tutorial> - extended CGI::Session manual
=item *
L<CGI::Session::CookBook|CGI::Session::CookBook> - practical solutions for real life problems
=item *
L<Redis|Redis> - Redis interface library.
=back
=cut
=head1 AUTHOR
Steve Kemp <steve@steve.org.uk>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2010-2016 Steve Kemp <steve@steve.org.uk>.
This library is free software. You can modify and or distribute it under
the same terms as Perl itself.
=cut
( run in 0.847 second using v1.01-cache-2.11-cpan-6aa56a78535 )