« blib/lib/Lemonldap/NG/Common/Regexp.pm
↑ Summary
blib/lib/Lemonldap/NG/Common/Logger/Log4perl.pm »
| 1 | |||||||||||
| 2 | package Lemonldap::NG::Common::Apache::Session::Lock; | ||||||||||
| 3 | |||||||||||
| 4 | 7 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 7 | our $VERSION = '2.0.0'; | |||||||||
| 7 | |||||||||||
| 8 | 6 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 9 | 6 | my $class = shift; | |||||||||
| 10 | 6 | my $session = shift; | |||||||||
| 11 | |||||||||||
| 12 | 6 | my $self = {}; | |||||||||
| 13 | 6 | $self->{args} = $session->{args}; | |||||||||
| 14 | 6 | bless $self, $class; | |||||||||
| 15 | 6 | return $self; | |||||||||
| 16 | } | ||||||||||
| 17 | |||||||||||
| 18 | 11 | ▶ | sub module { | ||||||||
|
Subroutine
module: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 19 | 11 | my $self = shift; | |||||||||
| 20 | 11 | return $self->{args}->{lock_manager}; | |||||||||
| 21 | } | ||||||||||
| 22 | |||||||||||
| 23 | 5 | ▶ | sub cache { | ||||||||
|
Subroutine
cache: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 24 | 5 | my $self = shift; | |||||||||
| 25 | |||||||||||
| 26 | 5 | ▶ | return $self->{cache} if $self->{cache}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | |||||||||||
| 28 | 5 | my $module = $self->{args}->{localStorage}; | |||||||||
| 29 | 5 | ▶ | eval "use $module;"; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 30 | 5 | $self->{cache} = $module->new( $self->{args}->{localStorageOptions} ); | |||||||||
| 31 | |||||||||||
| 32 | 5 | return $self->{cache}; | |||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | 5 | ▶ | sub acquire_read_lock { | ||||||||
|
Subroutine
acquire_read_lock: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 36 | 5 | my $self = shift; | |||||||||
| 37 | 5 | my $session = shift; | |||||||||
| 38 | |||||||||||
| 39 | # Get session from cache | ||||||||||
| 40 | 5 | my $id = $session->{data}->{_session_id}; | |||||||||
| 41 | 5 | ▶ | if ( $self->cache->get($id) ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | |||||||||||
| 43 | # got session from cache, no need to ask for locks | ||||||||||
| 44 | } | ||||||||||
| 45 | else { | ||||||||||
| 46 | 3 | $self->module->acquire_read_lock($session); | |||||||||
| 47 | } | ||||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | 2 | ▶ | sub acquire_write_lock { | ||||||||
|
Subroutine
acquire_write_lock: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 51 | 2 | my $self = shift; | |||||||||
| 52 | 2 | my $session = shift; | |||||||||
| 53 | |||||||||||
| 54 | 2 | $self->module->acquire_write_lock($session); | |||||||||
| 55 | } | ||||||||||
| 56 | |||||||||||
| 57 | 0 | ▶ | sub release_write_lock { | ||||||||
|
Subroutine
release_write_lock: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 58 | 0 | my $self = shift; | |||||||||
| 59 | 0 | my $session = shift; | |||||||||
| 60 | |||||||||||
| 61 | 0 | $self->module->release_write_lock($session); | |||||||||
| 62 | } | ||||||||||
| 63 | |||||||||||
| 64 | 6 | ▶ | sub release_all_locks { | ||||||||
|
Subroutine
release_all_locks: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 65 | 6 | my $self = shift; | |||||||||
| 66 | 6 | my $session = shift; | |||||||||
| 67 | |||||||||||
| 68 | 6 | $self->module->release_all_locks($session); | |||||||||
| 69 | } | ||||||||||
| 70 | |||||||||||
| 71 | 7 | 1; | |||||||||
| 72 | |||||||||||