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)
committerFrédéric Demians <f.demians@tamil.fr>
Thu, 16 Jun 2016 10:55:41 +0000 (12:55 +0200)
commit0a7dc07cb5051b7f2ae6e676c9b01ecf7b9c41e9
tree77a471a5ed61da36b196dd70f6bbab07f3ab125c
parenta0fb3fdf1a057dba56eb05ba6997d901bfcb9645
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>
(cherry picked from commit f01a07a25e0503d9dbed3a4226cb51a155bcacd4)
Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
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