[Koha-devel] RFC: Koha::Persistent - for plack and general performance

Paul Poulain paul.poulain at biblibre.com
Fri Apr 6 12:34:19 CEST 2012


Le 06/04/2012 12:08, Frédéric Demians a écrit :

> Dobrica Koha::Persistant module make sense to me. It has thread
> in-memory caching now, but can be extended to implement multi-thread
> in-memory or in memcached (or redis, MySQL...) caching. The question is
> more: is it necessary to mix caching and SQL querying? Isn't it too much
> or too complex? The key in Dobrica cache is calculated based on query
> parameters: is it robust enough?  
That's a question I have too.
Another one: couldn't this be replaced by a memoize _sql_cache
=> memoize return the result from cache if the parameters are the same
as one that have already be sent.

So, the _sql_cache could be rewritten:

use Memoize;
memoize('_sql_cache');
sub _sql_cache {
  my $sql = shift;
  my @var = @_;
  my $dbh = C4::Context->dbh;
  my $sth = $dbh->prepare( $sql );
  $sth->execute( @var );
  my $v = $sth->fetchrow_hashref;
}

Dobrica, aren't those 2 subs (yours and mine) equivalent ?
-- 
Paul POULAIN
http://www.biblibre.com
Expert en Logiciels Libres pour l'info-doc
Tel : (33) 4 91 81 35 08


More information about the Koha-devel mailing list