| Línea 17... |
Línea 17... |
| 17 |
namespace core_cache;
|
17 |
namespace core_cache;
|
| Línea 18... |
Línea 18... |
| 18 |
|
18 |
|
| 19 |
/**
|
19 |
/**
|
| 20 |
* Create and keep an instance of this class to allow temporary caches when caches are disabled.
|
20 |
* Create and keep an instance of this class to allow temporary caches when caches are disabled.
|
| 21 |
*
|
21 |
*
|
| 22 |
* This class works together with code in {@see cache_factory_disabled}.
|
22 |
* This class works together with code in {@see disabled_factory}.
|
| 23 |
*
|
23 |
*
|
| 24 |
* The intention is that temporary cache should be short-lived (not for the entire install process),
|
24 |
* The intention is that temporary cache should be short-lived (not for the entire install process),
|
| 25 |
* which avoids two problems: first, that we might run out of memory for the caches, and second,
|
25 |
* which avoids two problems: first, that we might run out of memory for the caches, and second,
|
| 26 |
* that some code e.g. install.php/upgrade.php files, is entitled to assume that caching is not
|
26 |
* that some code e.g. install.php/upgrade.php files, is entitled to assume that caching is not
|
| Línea 58... |
Línea 58... |
| 58 |
* goes out of scope. If you do need to remove your token at other times, use unset($token);
|
58 |
* goes out of scope. If you do need to remove your token at other times, use unset($token);
|
| 59 |
*
|
59 |
*
|
| 60 |
* If there are no other instances of this object, then all temporary caches will be discarded.
|
60 |
* If there are no other instances of this object, then all temporary caches will be discarded.
|
| 61 |
*/
|
61 |
*/
|
| 62 |
public function __destruct() {
|
62 |
public function __destruct() {
|
| 63 |
global $CFG;
|
- |
|
| 64 |
require_once($CFG->dirroot . '/cache/disabledlib.php');
|
- |
|
| 65 |
|
- |
|
| 66 |
self::$references--;
|
63 |
self::$references--;
|
| 67 |
if (self::$references === 0) {
|
64 |
if (self::$references === 0) {
|
| 68 |
\cache_factory_disabled::clear_temporary_caches();
|
65 |
disabled_factory::clear_temporary_caches();
|
| 69 |
}
|
66 |
}
|
| 70 |
}
|
67 |
}
|
| Línea 71... |
Línea 68... |
| 71 |
|
68 |
|
| 72 |
/**
|
69 |
/**
|