![]() |
Bearsampp 2026.7.11
|
Static Public Member Functions | |
| static | clear () |
| static | get ($cacheKey) |
| static | getDuration () |
| static | getStats () |
| static | recordHit () |
| static | recordMiss () |
| static | set ($cacheKey, $data) |
| static | setDuration ($seconds) |
Static Private Member Functions | |
| static | generateCacheHMAC ($data, $cacheKey) |
| static | getCacheIntegrityKey () |
| static | verifyCacheIntegrity ($fileContents, $cacheKey) |
Static Private Attributes | |
| static | $cacheIntegrityKey = null |
| static | $fileScanCache = null |
| static | $fileScanCacheDuration = 3600 |
| static | $fileScanStats |
Cache class for managing file scan caching with integrity verification.
This class handles caching of file scan results with optional integrity checks to prevent tampering. It supports both in-memory and file-based caching with configurable cache duration.
Usage Example:
Definition at line 27 of file class.cache.php.
|
static |
Clears all file scan caches.
Definition at line 271 of file class.cache.php.
References $bearsamppRoot, Path\getTmpPath(), and Log\info().
|
staticprivate |
Generates HMAC for cache data integrity verification.
| array | $data | The data to generate HMAC for |
| string | $cacheKey | The cache key |
Definition at line 229 of file class.cache.php.
References getCacheIntegrityKey().
Referenced by set(), and verifyCacheIntegrity().
|
static |
Gets cached file scan results if valid. Includes integrity verification to prevent cache tampering.
| string | $cacheKey | The cache key to retrieve. |
Definition at line 66 of file class.cache.php.
References $bearsamppRoot, Path\getTmpPath(), and Log\warning().
Referenced by Util\getFilesToScan().
|
staticprivate |
Generates or retrieves the cache integrity key. This key is unique per session to prevent cross-session cache tampering.
Definition at line 182 of file class.cache.php.
References $bearsamppRoot, Log\error(), and Path\getTmpPath().
Referenced by generateCacheHMAC().
|
static |
Gets the current file scan cache duration.
Definition at line 329 of file class.cache.php.
|
static |
Gets file scan cache statistics.
Definition at line 304 of file class.cache.php.
|
static |
Records a cache hit for statistics tracking.
Definition at line 339 of file class.cache.php.
Referenced by Util\getFilesToScan().
|
static |
Records a cache miss for statistics tracking.
Definition at line 349 of file class.cache.php.
Referenced by Util\getFilesToScan().
|
static |
Stores file scan results in cache with integrity protection.
| string | $cacheKey | The cache key to store under. |
| array | $data | The scan results to cache. |
Definition at line 147 of file class.cache.php.
References $bearsamppRoot, Log\debug(), generateCacheHMAC(), and Path\getTmpPath().
Referenced by Util\getFilesToScan().
|
static |
Sets the file scan cache duration.
| int | $seconds | Cache duration in seconds (default: 3600 = 1 hour). |
Definition at line 316 of file class.cache.php.
References Log\debug().
|
staticprivate |
Verifies cache file integrity using HMAC.
| string | $fileContents | The JSON-encoded cache file contents |
| string | $cacheKey | The cache key |
Definition at line 246 of file class.cache.php.
References generateCacheHMAC().
|
staticprivate |
Definition at line 56 of file class.cache.php.
|
staticprivate |
Definition at line 33 of file class.cache.php.
|
staticprivate |
Definition at line 39 of file class.cache.php.
|
staticprivate |
Definition at line 45 of file class.cache.php.