1Session::Lock::File(3)User Contributed Perl DocumentationSession::Lock::File(3)
2
3
4

NAME

6       Apache::Session::Lock::File - Provides mutual exclusion using flock
7

SYNOPSIS

9        use Apache::Session::Lock::File;
10
11        my $locker = new Apache::Session::Lock::File;
12
13        $locker->acquire_read_lock($ref);
14        $locker->acquire_write_lock($ref);
15        $locker->release_read_lock($ref);
16        $locker->release_write_lock($ref);
17        $locker->release_all_locks($ref);
18
19        $locker->clean($dir, $age);
20

DESCRIPTION

22       Apache::Session::Lock::File fulfills the locking interface of
23       Apache::Session.  Mutual exclusion is achieved through the use of tem‐
24       porary files and the "flock" function.
25

CONFIGURATION

27       The module must know where to create its temporary files.  You must
28       pass an argument in the usual Apache::Session style.  The name of the
29       argument is LockDirectory and its value is the path where you want the
30       lockfiles created.  Example:
31
32        tie %s, 'Apache::Session::Blah', $id, {LockDirectory => '/var/lock/sessions'}
33
34       If you do not supply this argument, temporary files will be created in
35       /tmp.
36

NOTES

38       This module does not unlink temporary files, because it interferes with
39       proper locking.  This can cause problems on certain systems (Linux)
40       whose file systems (ext2) do not perform well with lots of files in one
41       directory.  To prevent this you should use a script to clean out old
42       files from your lock directory.  The meaning of old is left as a policy
43       decision for the implementor, but a method is provided for implementing
44       that policy.  You can use the "clean" method of this module to remove
45       files unmodified in the last $age seconds.  Example:
46
47        my $l = new Apache::Session::Lock::File;
48        $l->clean('/var/lock/sessions', 3600) #remove files older than 1 hour
49
50       Win32 and Cygwin
51
52       Windows cannot escalate lock, so all locks will be exclusive.
53
54       release_read_lock not supported - it is not used by Apache::Session.
55
56       When deleting files, they are not locked (Win32 only).
57

AUTHOR

59       This module was written by Jeffrey William Baker <jwbaker@acm.org>.
60

SEE ALSO

62       Apache::Session
63
64
65
66perl v5.8.8                       2004-02-24            Session::Lock::File(3)
Impressum