in reply to Sitewide states in a web application (specifically cache locking in Catalyst)
note: this code first tries to find the shmem segment, and if it exists it destroys it. this prevents you from allocating additional memory with each restart of apache.use IPC::Shareable ':lock'; [...] no warnings 'untie'; my $knot; my $glue = "SHMEMGLUE"; eval { $knot = tie %tie, 'IPC::Shareable', $appdata{$glue}, { create = +> 0, mode => 0666, size => $appdata{SHMEMSIZE}, exclusive + => 0, destroy => 0 }; }; unless ($@) { $knot->remove; untie %tie; undef $knot; } $knot = tie %tie, 'IPC::Shareable', $appdata{$glue}, { create => 1, mo +de => 0666, size => $appdata{SHMEMSIZE}, exclusive => + 0, destroy => 0 }; untie %tie;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Sitewide states in a web application (specifically cache locking in Catalyst)
by Ionitor (Scribe) on Jun 30, 2007 at 09:50 UTC |