blob: 8bc72d9769440ce9c49c45e1ce4c35cd67009d18 (
plain) (
blame)
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
|
<?php
namespace dokuwiki\Cache;
/**
* Caching of parser instructions
*/
class CacheInstructions extends CacheParser
{
/**
* @param string $id page id
* @param string $file source file for cache
*/
public function __construct($id, $file)
{
parent::__construct($id, $file, 'i');
}
/**
* retrieve the cached data
*
* @param bool $clean true to clean line endings, false to leave line endings alone
* @return array cache contents
*/
public function retrieveCache($clean = true)
{
$contents = io_readFile($this->cache, false);
return empty($contents) ? [] : unserialize($contents);
}
/**
* cache $instructions
*
* @param array $instructions the instruction to be cached
* @return bool true on success, false otherwise
*/
public function storeCache($instructions)
{
if ($this->_nocache) {
return false;
}
return io_saveFile($this->cache, serialize($instructions));
}
}
|