[Koha-devel] using CHI directly to use all of it's advantages

Dobrica Pavlinusic dpavlin at rot13.org
Thu Jun 14 20:28:29 CEST 2012


As some of you allready know, Jonathan Swartz had presentation about CHI: Universal caching for Perl
at YAPC::NA. Video recording is available at:

http://ics.webcast.uwex.edu/mediasite/Viewer/?peid=b503ecb42c18452a9f4a95b7372648711d

It got me thinking about our new Koha::Cache layer. For a start, I would
love to use CHI directly and make it required depenency for Koha since
it has following features which we already use:
- memcached back-end - making our own memcache implementation obsolete
- fastmmap back-end - ditto
- DBI cache - making mysql query cache problem solvable
  way than DBD::Goper suggestion from
  http://wiki.koha-community.org/wiki/Performance#MySQL_tuning
- memoize
- very nice syntax:

my $customer2 = $cache->compute($name2, "10 minutes", sub {
        get_customer_from_db($name2)
});

Which I would prefer to our existing Koha::Cache API. It would also save
us quite a bit of code.

CHI has powerfull statistics which basically obsolete my idea of writing
statistics gathering code through Koha.

I would love to have this in next release, since this is more-or-less my
last major gripe with current Koha code (short-term goal[1]), so if I
would love to hear feedback.

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

My more long-term goal is to know more about Koha's data-access
patterns (you are again advised to examine performance wiki page if you
haven't up to this point).

In most simple sense, only think which is big unknown is wheater we can
find sane key namespace schema which will allow us to good-enough cache
invalidation scheme. I strongly think that time-outs are useful just for
OPAC, not for intranet use!

It seems to me that CHI redis back-end (which can introspect keyspace
with keys *) and my "weekly push master in production because of plack"
approach might bring us to better understanding how our Model layer
might look like, allmost like reverse engeeniring existing code access
patterns which has proven to bring a lot of low-hanging fruits so far.

Only disadvantage I can think of is that CHI isn't packaged in stable
Debian but it is in wheezy so Robin would not need to package it
forever, just for little while :-)

-- 
Dobrica Pavlinusic               2share!2flame            dpavlin at rot13.org
Unix addict. Internet consultant.             http://www.rot13.org/~dpavlin


More information about the Koha-devel mailing list