mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-02-22 02:46:30 +00:00
Add caching to the auto_loader for interfaces (#7320)
* update auto loader to load and cache interfaces * use new method to update the auto loader cache * use new interface * use new interface to trigger a cache flush * update the console upgrade menu * update the missing implements syntax * add the clear_cache to the flush cache button
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
* @access public
|
||||
* @author Mark Crane <mark@fusionpbx.com>
|
||||
*/
|
||||
class settings {
|
||||
class settings implements clear_cache {
|
||||
|
||||
/**
|
||||
* Set in the constructor. String used to load a specific domain. Must be a value domain UUID before sending to the constructor.
|
||||
@@ -446,31 +446,13 @@ class settings {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the settings cache
|
||||
* @param string $type Empty clears all settings. Values can be global, domain, or user.
|
||||
*/
|
||||
public static function clear_cache(string $type = '') {
|
||||
if (function_exists('apcu_enabled') && apcu_enabled()) {
|
||||
switch ($type) {
|
||||
case 'all':
|
||||
case '':
|
||||
default:
|
||||
$type = "";
|
||||
break;
|
||||
case 'global':
|
||||
case 'domain':
|
||||
case 'user':
|
||||
$type .= "_";
|
||||
break;
|
||||
}
|
||||
$cache = apcu_cache_info(false);
|
||||
if (!empty($cache['cache_list'])) {
|
||||
foreach ($cache['cache_list'] as $entry) {
|
||||
$key = $entry['info'];
|
||||
if (str_starts_with($key, 'settings_' . $type)) {
|
||||
apcu_delete($key);
|
||||
}
|
||||
public static function clear_cache() {
|
||||
$cache = apcu_cache_info(false);
|
||||
if (!empty($cache['cache_list'])) {
|
||||
foreach ($cache['cache_list'] as $entry) {
|
||||
$key = $entry['info'];
|
||||
if (str_starts_with($key, 'settings_')) {
|
||||
apcu_delete($key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user