class Cache in Render cache 7.2
Same name in this branch
- 7.2 src/Cache/Cache.php \Drupal\render_cache\Cache\Cache
- 7.2 lib/Drupal/Core/Cache/Cache.php \Drupal\Core\Cache\Cache
Helper methods for cache.
Hierarchy
Expanded class hierarchy of Cache
2 files declare their use of Cache
- BaseController.php in src/
RenderCache/ Controller/ BaseController.php - Contains \Drupal\render_cache\RenderCache\Controller\BaseController
- CacheTest.php in tests/
src/ Cache/ CacheTest.php - Contains \Drupal\render_cache\Tests\Cache\CacheTest
File
- src/
Cache/ Cache.php, line 18 - Contains \Drupal\render_cache\Cache\Cache.
Namespace
Drupal\render_cache\CacheView source
class Cache extends D8Cache {
/**
* Generates a hash from a query object, to be used as part of the cache key.
*
* This smart caching strategy saves Drupal from querying and rendering to
* HTML when the underlying query is unchanged.
*
* Expensive queries should use the query builder to create the query and then
* call this function. Executing the query and formatting results should
* happen in a #pre_render callback.
*
* Note: This function was overridden to provide the D7 version of
* SelectQueryInterface.
*
* @param \SelectQueryInterface
* A select query object.
*
* @return string
* A hash of the query arguments.
*/
public static function keyFromQuery(SelectQueryInterface $query) {
$query
->preExecute();
$keys = array(
(string) $query,
$query
->getArguments(),
);
return hash('sha256', serialize($keys));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Cache:: |
public static | function | Build an array of cache tags from a given prefix and an array of suffixes. | |
Cache:: |
public static | function | Deletes items from all bins with any of the specified tags. | |
Cache:: |
public static | function | Gets all cache bin services. | |
Cache:: |
public static | function | Marks cache items from all bins with any of the specified tags as invalid. | |
Cache:: |
public static | function | Generates a hash from a query object, to be used as part of the cache key. | |
Cache:: |
public static | function | Merges arrays of cache tags and removes duplicates. | |
Cache:: |
constant | Indicates that the item should never be removed unless explicitly deleted. | ||
Cache:: |
public static | function | Validates an array of cache tags. |