mirror of
https://github.com/grocy/grocy.git
synced 2026-04-05 20:36:15 +02:00
store localisation service in apcu
This commit is contained in:
parent
384d2b21fb
commit
1d9e69dbda
1
app.php
1
app.php
|
|
@ -63,6 +63,7 @@ if (GROCY_DISABLE_AUTH === true)
|
||||||
],
|
],
|
||||||
'view' => function($container)
|
'view' => function($container)
|
||||||
{
|
{
|
||||||
|
return new \Slim\Views\Blade(__DIR__ . '/views', GROCY_DATAPATH . '/viewcache');
|
||||||
if (!apcu_exists("views"))
|
if (!apcu_exists("views"))
|
||||||
{
|
{
|
||||||
apcu_store("views", new \Slim\Views\Blade(__DIR__ . '/views', GROCY_DATAPATH . '/viewcache'));
|
apcu_store("views", new \Slim\Views\Blade(__DIR__ . '/views', GROCY_DATAPATH . '/viewcache'));
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ use \Gettext\Translator;
|
||||||
class LocalizationService
|
class LocalizationService
|
||||||
{
|
{
|
||||||
|
|
||||||
private static $instanceMap = array();
|
#private static $instanceMap = array();
|
||||||
|
|
||||||
public function __construct(string $culture)
|
public function __construct(string $culture)
|
||||||
{
|
{
|
||||||
|
|
@ -23,12 +23,17 @@ class LocalizationService
|
||||||
|
|
||||||
public static function getInstance(string $culture)
|
public static function getInstance(string $culture)
|
||||||
{
|
{
|
||||||
if (!in_array($culture, self::$instanceMap))
|
#if (!in_array($culture, self::$instanceMap))
|
||||||
|
#{
|
||||||
|
# self::$instanceMap[$culture] = new self($culture);
|
||||||
|
#}
|
||||||
|
if (!apcu_exists("grocy_LocalizationService_".$culture))
|
||||||
{
|
{
|
||||||
self::$instanceMap[$culture] = new self($culture);
|
apcu_store("grocy_LocalizationService_".$culture, new self($culture));
|
||||||
}
|
}
|
||||||
|
return apcu_fetch("grocy_LocalizationService_".$culture);
|
||||||
|
|
||||||
return self::$instanceMap[$culture];
|
#return self::$instanceMap[$culture];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected $DatabaseService;
|
protected $DatabaseService;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user