Bug 16088: Introduce Koha::Cache::Memory::Lite to cache the language
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 9 May 2016 16:27:51 +0000 (17:27 +0100)
committerBrendan Gallagher <brendan@bywatersolutions.com>
Sat, 4 Jun 2016 07:43:22 +0000 (07:43 +0000)
commitf01a07a25e0503d9dbed3a4226cb51a155bcacd4
treea4ea47d9056d2dab5880f4aff0063e18d0c09d2e
parentfc35a5099f613c08d12be1d67fd027d4a5eaf99c
Bug 16088: Introduce Koha::Cache::Memory::Lite to cache the language

The goal of this patch is to avoid unecessary flush of the L1 cache on
creating a new CGI object each time C4::Languages::getlanguage is called
without a CGI object.

The new class Koha::Cache::Memory::Lite must be flushed by the CGI
constructor overide done in the psgi file. This new class will ease
caching of specific stuffs used by running script.

Test plan:
At the OPAC and the intranet interfaces:
Open 2 different browser session to simulate several users
- Clear the cookies of the browsers
- User 1 (U1) an User 2 (U2) should be set to the default language
  (depending on the browser settings)
- U1 chooses another language
- U2 refreshes and the language used must be the default one
- U2 chooses a third language
- U1 refreshes and must be still using the one he has choosen.

Try to use a language which is not defined:
Add &language=es-ES (if es-ES is not translated) to the url, you should
not see the Spanish interface.

Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>

Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
C4/Languages.pm
C4/Templates.pm
Koha/Cache/Memory/Lite.pm [new file with mode: 0644]
debian/templates/plack.psgi
misc/plack/koha.psgi
t/Cache.t