Commit 008a1e89 authored by colemanw's avatar colemanw
Browse files

Merge branch 'master-cache' into 'master'

AfformScanner - Simplify cache. Fix CLI/web sync bug and unit-test flakiness.

See merge request extensions/afform!19
parents 747b8441 ba5cae19
......@@ -27,12 +27,7 @@ class CRM_Afform_AfformScanner {
* CRM_Afform_AfformScanner constructor.
*/
public function __construct() {
// TODO Manage this is a service, and inject the cache service.
$this->cache = new CRM_Utils_Cache_SqlGroup([
'group' => md5('afform_' . CRM_Core_Config_Runtime::getId() . $this->getSiteLocalPath()),
'prefetch' => FALSE,
]);
// $this->cache = new CRM_Utils_Cache_Arraycache([]);
$this->cache = Civi::cache('long');
}
/**
......@@ -44,7 +39,7 @@ class CRM_Afform_AfformScanner {
public function findFilePaths() {
if (!CRM_Core_Config::singleton()->debug) {
// FIXME: Use a separate setting. Maybe use the asset-builder cache setting?
$paths = $this->cache->get('allPaths');
$paths = $this->cache->get('afformAllPaths');
if ($paths !== NULL) {
return $paths;
}
......@@ -67,7 +62,7 @@ class CRM_Afform_AfformScanner {
$this->appendFilePaths($paths, $this->getSiteLocalPath(), 10);
$this->cache->set('allPaths', $paths);
$this->cache->set('afformAllPaths', $paths);
return $paths;
}
......@@ -111,7 +106,7 @@ class CRM_Afform_AfformScanner {
}
public function clear() {
$this->cache->flush();
$this->cache->delete('afformAllPaths');
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment