This repository was archived by the owner on Oct 20, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCache.php
More file actions
49 lines (45 loc) · 1.32 KB
/
Cache.php
File metadata and controls
49 lines (45 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
namespace PhpSlides\Core\Cache;
use PhpSlides\Core\Foundation\Application;
/**
* Class Cache
*
* This class handles cache management operations within the PhpSlides framework.
* It provides functionality to clear all cache or clear specific cache items,
* such as the hot reload cache.
*/
class Cache
{
/**
* Clears all cache stored in the 'app/cache' directory.
*
* This method checks if the cache directory exists and removes it,
* effectively clearing all cached files. It is commonly used to
* reset the cache during development or when cache corruption occurs.
*/
public static function clear ()
{
// Check if the cache directory exists
if (is_dir(Application::$basePath . 'app/cache'))
{
// Remove the cache directory
rmdir(Application::$basePath . 'app/cache');
}
}
/**
* Clears the Hot Reload cache specifically.
*
* This method checks if the 'hot-reload.json' cache file exists and removes it.
* It is typically used during development when hot reload functionality
* needs to be reset or reloaded.
*/
public static function clearHotReload ()
{
// Check if the hot-reload cache file exists
if (file_exists(Application::$basePath . 'app/cache/hot-reload.json'))
{
// Delete the hot-reload cache file
unlink(Application::$basePath . 'app/cache/hot-reload.json');
}
}
}