[Koha-bugs] [Bug 13431] Shared FastMmap file causes issues

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Dec 16 22:32:19 CET 2014


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13431

--- Comment #16 from Chris Cormack <chris at bigballofwax.co.nz> ---
Comment on attachment 34453
  --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=34453
Bug 13431 - Shared FastMmap file causes issues

Review of attachment 34453:
 --> (http://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=13431&attachment=34453)
-----------------------------------------------------------------

::: Koha/Cache.pm
@@ +40,4 @@
>  use Carp;
>  use Module::Load::Conditional qw(can_load);
>  use Koha::Cache::Object;
> +use C4::Context;

We can't do this. We just added a big circular dependency if we do.

Because C4::Context uses Koha::Cache

@@ +92,5 @@
>      }
>  
> +    if ( $self->{'default_type'} eq 'fastmmap'
> +      && defined( $ENV{GATEWAY_INTERFACE} )
> +      && can_load( modules => { 'Cache::FastMmap' => undef } ) ) {

This change seems good.

@@ +162,5 @@
>  sub _initialize_fastmmap {
>      my ($self) = @_;
> +    my $share_file = join( '-',
> +        "/tmp/sharefile-koha", $self->{'namespace'},
> +        C4::Context->config('hostname'), C4::Context->config('database'),

A better way to do this is is to change the places that call Koha::Cache->new() 
To set the namespace. 

EG my $cache = Koha::Cache-new({cache_type => 'memcached_cache', namespace =>
C4::Context->config('hostname') . '-' .C4::Context->config('database')});

I reread the code, and there isn't a bug in Koha::Cache, there is a bug in how
we are calling it.
$self->{'namespace'} ||= $ENV{MEMCACHED_NAMESPACE} || 'koha'; 
Is what is in the module, we just are never setting namespace, so it defaults
to what is in the ENV, or just koha

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list