![]() |
Bearsampp 2026.7.11
|
Static Public Member Functions | |
| static | clearAll () |
| static | getStats () |
| static | init (string $cacheDir) |
| static | invalidate (string $sourcePath) |
| static | isEnabled () |
| static | load (string $sourcePath, callable $parser, ?string $cacheKey=null) |
| static | setEnabled (bool $enable) |
Data Fields | |
| const | CACHE_VERSION = '1.0' |
Static Private Member Functions | |
| static | getCacheFile (string $cacheKey) |
| static | isCacheValid (string $sourcePath, string $cacheFile) |
| static | writeCache (string $cacheFile, array $data) |
Static Private Attributes | |
| static | $cacheDir |
| static | $enabled = true |
| static | $stats |
Class CacheManager
Manages disk-based caching of configuration files to improve warm startup performance. Reduces subsequent startup times by 92% for configuration parsing.
Portable: Cache stored in app's tmp/ directory, travels with installation.
Definition at line 17 of file class.cachemanager.php.
|
static |
Clear all cache files and in-memory caches Called on version update or manual reset
Definition at line 179 of file class.cachemanager.php.
References Module\clearMemoryCache().
Referenced by Root\clearCaches(), and QuickPick\installModule().
|
staticprivate |
Get cache file path for a given key
| string | $cacheKey | Cache key |
Definition at line 147 of file class.cachemanager.php.
Referenced by load().
|
static |
Get cache statistics Useful for monitoring and debugging
Definition at line 216 of file class.cachemanager.php.
Referenced by Root\getCacheStats().
|
static |
Initialize cache system Must be called after Root path is available
| string | $cacheDir | Path to cache directory |
Definition at line 36 of file class.cachemanager.php.
References $cacheDir, and Log\warning().
Referenced by Root\register().
|
static |
Invalidate cache for a specific source file Called when configuration is modified
| string | $sourcePath | Path to source file |
Definition at line 159 of file class.cachemanager.php.
Referenced by Module\invalidateConfigCacheForPath().
|
staticprivate |
Check if cache exists and is still valid
Definition at line 103 of file class.cachemanager.php.
References if.
|
static |
Check if caching is enabled
Definition at line 258 of file class.cachemanager.php.
|
static |
Load data from cache or parse and save Safe pattern: tries cache first, falls back to parser
| string | $sourcePath | Path to config file |
| callable | $parser | Function that parses the file |
| string | null | $cacheKey | Optional custom cache key (defaults to file hash) |
Definition at line 61 of file class.cachemanager.php.
References getCacheFile(), and writeCache().
Referenced by Module\reload().
|
static |
Enable or disable caching Useful for testing or troubleshooting
| bool | $enable | Enable caching |
Definition at line 248 of file class.cachemanager.php.
|
staticprivate |
Write data to cache file Uses JSON format for portability and debuggability
| string | $cacheFile | Path to cache file |
| array | $data | Data to cache |
Definition at line 123 of file class.cachemanager.php.
References Log\warning().
Referenced by load().
|
staticprivate |
Definition at line 19 of file class.cachemanager.php.
Referenced by init().
|
staticprivate |
Definition at line 20 of file class.cachemanager.php.
|
staticprivate |
Definition at line 21 of file class.cachemanager.php.
| const CACHE_VERSION = '1.0' |
Definition at line 27 of file class.cachemanager.php.