|
Lines 40-45
use warnings;
Link Here
|
| 40 |
use Carp; |
40 |
use Carp; |
| 41 |
use Module::Load::Conditional qw(can_load); |
41 |
use Module::Load::Conditional qw(can_load); |
| 42 |
use Koha::Cache::Object; |
42 |
use Koha::Cache::Object; |
|
|
43 |
use C4::Context; |
| 43 |
|
44 |
|
| 44 |
use base qw(Class::Accessor); |
45 |
use base qw(Class::Accessor); |
| 45 |
|
46 |
|
|
Lines 90-99
sub new {
Link Here
|
| 90 |
} |
91 |
} |
| 91 |
} |
92 |
} |
| 92 |
|
93 |
|
| 93 |
if ( can_load( modules => { 'Cache::FastMmap' => undef } ) ) { |
94 |
if ( $self->{'default_type'} eq 'fastmmap' |
|
|
95 |
&& defined( $ENV{GATEWAY_INTERFACE} ) |
| 96 |
&& can_load( modules => { 'Cache::FastMmap' => undef } ) ) { |
| 94 |
_initialize_fastmmap($self); |
97 |
_initialize_fastmmap($self); |
| 95 |
if ( $self->{'default_type'} eq 'fastmmap' |
98 |
if ( defined( $self->{'fastmmap_cache'} ) ) |
| 96 |
&& defined( $self->{'fastmmap_cache'} ) ) |
|
|
| 97 |
{ |
99 |
{ |
| 98 |
$self->{'cache'} = $self->{'fastmmap_cache'}; |
100 |
$self->{'cache'} = $self->{'fastmmap_cache'}; |
| 99 |
} |
101 |
} |
|
Lines 159-167
sub _initialize_memcached {
Link Here
|
| 159 |
|
161 |
|
| 160 |
sub _initialize_fastmmap { |
162 |
sub _initialize_fastmmap { |
| 161 |
my ($self) = @_; |
163 |
my ($self) = @_; |
|
|
164 |
my $share_file = join( '-', |
| 165 |
"/tmp/sharefile-koha", $self->{'namespace'}, |
| 166 |
C4::Context->config('hostname'), C4::Context->config('database'), |
| 167 |
"" . getpwuid($>) ); |
| 162 |
|
168 |
|
| 163 |
$self->{'fastmmap_cache'} = Cache::FastMmap->new( |
169 |
$self->{'fastmmap_cache'} = Cache::FastMmap->new( |
| 164 |
'share_file' => "/tmp/sharefile-koha-$self->{'namespace'}", |
170 |
'share_file' => $share_file, |
| 165 |
'expire_time' => $self->{'timeout'}, |
171 |
'expire_time' => $self->{'timeout'}, |
| 166 |
'unlink_on_exit' => 0, |
172 |
'unlink_on_exit' => 0, |
| 167 |
); |
173 |
); |
| 168 |
- |
|
|