Hello,
In a snippet I’m trying get some generated HTML code from the cache which I put there before. The HTML is generated from a chunk and a database record like so:
$html = $modx->cacheManager->get($key); // cannot get this
if(empty($html)) {
$html = $modx->getChunk($chunkname, $array); // $array filled by $object->get('stuff'); (xpdo)
$modx->cacheManager->set($key, $html);
}
return $html;
I can see there is the file in the cache. But the snippet cannot get() it from there again. It always returns an empty string and the cache file is removed. The problem seem to be the line breaks. I used preg_replace to remove them - and it’s working now.
Is this a bug, a encoding problem or am I using it wrong?
If it’s important: revo 2.0.8
// now, removing linebreaks does not help.. I’ve no clue whats going on here.. Sinple adding a string to the cache works.