Merge pull request #3024 from splitbrain/cookieupdate
[dokuwiki.git] / inc / Cache / CacheInstructions.php
blobacd02abae41ebcde0bee98320d2985938f7da7fc
1 <?php
3 namespace dokuwiki\Cache;
5 /**
6 * Caching of parser instructions
7 */
8 class CacheInstructions extends \dokuwiki\Cache\CacheParser
11 /**
12 * @param string $id page id
13 * @param string $file source file for cache
15 public function __construct($id, $file)
17 parent::__construct($id, $file, 'i');
20 /**
21 * retrieve the cached data
23 * @param bool $clean true to clean line endings, false to leave line endings alone
24 * @return array cache contents
26 public function retrieveCache($clean = true)
28 $contents = io_readFile($this->cache, false);
29 return !empty($contents) ? unserialize($contents) : array();
32 /**
33 * cache $instructions
35 * @param array $instructions the instruction to be cached
36 * @return bool true on success, false otherwise
38 public function storeCache($instructions)
40 if ($this->_nocache) {
41 return false;
44 return io_saveFile($this->cache, serialize($instructions));