diff --git a/app/Config/core.default.php b/app/Config/core.default.php index 697c107f0..b277abe0d 100644 --- a/app/Config/core.default.php +++ b/app/Config/core.default.php @@ -255,10 +255,6 @@ Configure::write('Acl.database', 'default'); * and their setttings. */ $engine = 'File'; -if (function_exists('apcu_dec') && (PHP_SAPI !== 'cli' || ini_get('apc.enable_cli'))) { - require_once APP . 'Plugin/ApcuCache/Engine/ApcuEngine.php'; // it is not possible to use plugin - $engine = 'Apcu'; // faster version of ApcEngine -} // In development mode, caches should expire quickly. $duration = '+999 days'; @@ -293,11 +289,5 @@ Cache::config('_cake_model_', array( 'duration' => $duration )); -Cache::config('misp_short', array( - 'engine' => $engine, - 'duration' => '1800', // 30 minutes - 'prefix' => 'misp_cache_short_', -)); - //Comment the following out if you do not with to use the background workers (not recommended) require_once dirname(__DIR__) . '/Vendor/autoload.php'; diff --git a/app/Model/Taxonomy.php b/app/Model/Taxonomy.php index da4138687..810fd6f0b 100644 --- a/app/Model/Taxonomy.php +++ b/app/Model/Taxonomy.php @@ -589,9 +589,10 @@ class Taxonomy extends AppModel } $key = 'taxonomies_cache:tagName=' . $tagName . "&" . "metaOnly=$metaOnly" . "&" . "fullTaxonomy=$fullTaxonomy"; - $model = $this; + $redis = $this->setupRedisWithException(); + $taxonomy = json_decode($redis->get($key), true); - return Cache::remember($key, function () use ($model, $metaOnly, $fullTaxonomy, $splits) { + if (!$taxonomy) { if (isset($splits['value'])) { $contain = array( 'TaxonomyPredicate' => array( @@ -606,7 +607,7 @@ class Taxonomy extends AppModel 'LOWER(TaxonomyEntry.value)' => mb_strtolower($splits['value']), ); } - $taxonomy = $model->find('first', array( + $taxonomy = $this->find('first', array( 'recursive' => -1, 'conditions' => array('LOWER(Taxonomy.namespace)' => mb_strtolower($splits['namespace'])), 'contain' => $contain @@ -614,8 +615,6 @@ class Taxonomy extends AppModel if ($metaOnly && !empty($taxonomy)) { $taxonomy = array('Taxonomy' => $taxonomy['Taxonomy']); } - - return $taxonomy; } else { $contain = array('TaxonomyPredicate' => array()); if (!$fullTaxonomy) { @@ -623,7 +622,7 @@ class Taxonomy extends AppModel 'LOWER(TaxonomyPredicate.value)' => mb_strtolower($splits['predicate']) ); } - $taxonomy = $model->find('first', array( + $taxonomy = $this->find('first', array( 'recursive' => -1, 'conditions' => array('LOWER(Taxonomy.namespace)' => mb_strtolower($splits['namespace'])), 'contain' => $contain @@ -631,10 +630,12 @@ class Taxonomy extends AppModel if ($metaOnly && !empty($taxonomy)) { $taxonomy = array('Taxonomy' => $taxonomy['Taxonomy']); } - - return $taxonomy; } - }, 'misp_short'); + + $redis->setex($key, 1800, $taxonomy); + } + + return $taxonomy; } /** diff --git a/travis/core.php b/travis/core.php index 4bfe22bb1..c22dee853 100644 --- a/travis/core.php +++ b/travis/core.php @@ -270,12 +270,6 @@ Cache::config('_cake_core_', array( 'duration' => $duration )); -Cache::config('misp_short', array( - 'engine' => $engine, - 'duration' => '1800', // 30 minutes - 'prefix' => 'misp_cache_short_', -)); - /** * Configure the cache for model and datasource caches. This cache configuration * is used to store schema descriptions, and table listings in connections.