More checks on cache returned values.

Switched to Redis in tests.
This commit is contained in:
Benoît Burnichon
2015-06-12 12:09:00 +02:00
parent 4241fd0e6c
commit 43d93eef36
4 changed files with 9 additions and 8 deletions

View File

@@ -420,8 +420,7 @@ class appbox extends base
} }
/** /**
* * @param string $option
* @param <type> $option
* @return string * @return string
*/ */
public function get_cache_key($option = null) public function get_cache_key($option = null)

View File

@@ -100,7 +100,11 @@ class phrasea
{ {
if (!self::$_bas2sbas) { if (!self::$_bas2sbas) {
try { try {
self::$_bas2sbas = $app['phraseanet.appbox']->get_data_from_cache(self::CACHE_SBAS_FROM_BAS); $data = $app['phraseanet.appbox']->get_data_from_cache(self::CACHE_SBAS_FROM_BAS);
if (!$data) {
throw new \Exception('Could not get sbas from cache');
}
self::$_bas2sbas = $data;
} catch (\Exception $e) { } catch (\Exception $e) {
$sql = 'SELECT base_id, sbas_id FROM bas'; $sql = 'SELECT base_id, sbas_id FROM bas';
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);

View File

@@ -18,10 +18,10 @@ main:
path: '/tmp/db.sqlite' path: '/tmp/db.sqlite'
charset: UTF8 charset: UTF8
cache: cache:
type: MemcacheCache type: RedisCache
options: options:
host: localhost host: localhost
port: 11211 port: 6379
search-engine: search-engine:
type: elasticsearch type: elasticsearch
# type: phrasea # type: phrasea

View File

@@ -6,8 +6,6 @@
use Alchemy\Phrasea\CLI; use Alchemy\Phrasea\CLI;
return call_user_func(function (CLI $cli) { return call_user_func(function (CLI $cli) {
$app = $cli; if ($app['plugins.manager']->isEnabled('web-gallery-plugin')) { $app = $cli;
$cli->command(Alchemy\WebGallery\Command\InstallCommand::create()); $cli->command(Alchemy\WebGallery\Command\UninstallCommand::create()); $cli->command(Alchemy\WebGallery\Command\UpdateCommand::create()); }
return $cli; return $cli;
}, $cli); }, $cli);