By jessebeach on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Introduced in version:
8.0-alpha9
Issue links:
Description:
The previous constant CacheBackendInterface::CACHE_PERMANENT exposes too much internal complexity into user-space code. The primary interaction point for modules is cache() (read + create) and \Drupal\Core\Cache\Cache (invalidation).
Module developers are now encouraged to use Cache::CACHE_PERMANENT where they would have used CacheBackendInterface::CACHE_PERMANENT.
Here are some specific replacement examples from the patch:
Before
// Cache the tree building parameters using the page-specific cid.
cache('menu')->set($cid, $tree_parameters, CacheBackendInterface::CACHE_PERMANENT, array('menu' => $menu_name));
After
// Cache the tree building parameters using the page-specific cid.
cache('menu')->set($cid, $tree_parameters, Cache::PERMANENT, array('menu' => $menu_name));
Before
// Store in persistent cache.
$this->cacheBackend->set('field_info:fields', $this->fieldsById, CacheBackendInterface::CACHE_PERMANENT, array('field_info' => TRUE)); // Store in persistent cache.
$this->cacheBackend->set('field_info:fields', $this->fieldsById, Cache::PERMANENT, array('field_info' => TRUE));
Impacts:
Module developers