_cache_get_object

Versions
7
_cache_get_object($bin)

Get the cache object for a cache bin.

By default, this returns an instance of the DrupalDatabaseCache class. Classes implementing DrupalCacheInterface can register themselves both as a default implementation and for specific bins.

See also

DrupalCacheInterface

Parameters

$bin The cache bin for which the cache object should be returned.

▾ 5 functions call _cache_get_object()

cache_clear_all in includes/cache.inc
Expire data from the cache.
cache_get in includes/cache.inc
Return data from the persistent cache. Data may be stored as either plain text or as serialized data. cache_get will automatically return unserialized objects and arrays.
cache_get_multiple in includes/cache.inc
Return data from the persistent cache when given an array of cache IDs.
cache_is_empty in includes/cache.inc
Check if a cache bin is empty.
cache_set in includes/cache.inc
Store data in the persistent cache.

Code

includes/cache.inc, line 15

<?php
function _cache_get_object($bin) {
  // We do not use drupal_static() here because we do not want to change the
  // storage of a cache bin mid-request.
  static $cache_objects, $default_class;
  if (!isset($cache_objects[$bin])) {
    $class = variable_get('cache_class_' . $bin);
    if (!isset($class)) {
      $class = variable_get('cache_default_class', 'DrupalDatabaseCache');
    }
    $cache_objects[$bin] = new $class($bin);
  }
  return $cache_objects[$bin];
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.