Commit edad3862 authored by alexpott's avatar alexpott
Browse files

Issue #2567133 by Wim Leers: getTypes in TypeLinkManager doesn't work with the null cache back end

parent d4c41939
......@@ -89,10 +89,12 @@ protected function getTypes($context = array()) {
$cid = 'rest:links:types';
$cache = $this->cache->get($cid);
if (!$cache) {
$this->writeCache($context);
$cache = $this->cache->get($cid);
$data = $this->writeCache($context);
}
return $cache->data;
else {
$data = $cache->data;
}
return $data;
}
/**
......@@ -100,6 +102,10 @@ protected function getTypes($context = array()) {
*
* @param array $context
* Context from the normalizer/serializer operation.
*
* @return array
* An array of typed data ids (entity_type and bundle) keyed by
* corresponding type URI.
*/
protected function writeCache($context = array()) {
$data = array();
......@@ -125,6 +131,7 @@ protected function writeCache($context = array()) {
// These URIs only change when entity info changes, so cache it permanently
// and only clear it when entity_info is cleared.
$this->cache->set('rest:links:types', $data, Cache::PERMANENT, array('entity_types'));
return $data;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment