1.20.x cache_database.inc protected BackdropDatabaseCache::prepareItem($cache)

Prepares a cached item.

Checks that items are either permanent or did not expire, and unserializes data as appropriate.

Parameters

$cache: An item loaded from BackdropCacheInterface::get() or BackdropCacheInterface::getMultiple().

Return value

stdClass|FALSE: The item with data unserialized as appropriate or FALSE if there is no valid item to load.

File

drivers/cache_database/cache_database.inc, line 81

Class

BackdropDatabaseCache
Defines a default cache implementation.

Code

protected function prepareItem($cache) {
  if (!isset($cache->data)) {
    return FALSE;
  }

  if ($cache->serialized) {
    $cache->data = unserialize($cache->data);
  }

  return $cache;
}