You are here

function dmemcache_piece_cache_get in Memcache API and Integration 7

Same name and namespace in other branches
  1. 6 dmemcache.inc \dmemcache_piece_cache_get()

Determine if a key has multi-piece values.

Parameters

string $cid: The cid to check for multi-piece values.

Return value

integer Expiration time if key has multi-piece values, otherwise FALSE.

1 call to dmemcache_piece_cache_get()
dmemcache_delete in ./dmemcache.inc
Deletes an item from the cache.

File

./dmemcache.inc, line 1192
A memcache API for Drupal.

Code

function dmemcache_piece_cache_get($name) {
  static $drupal_static_fast;
  if (!isset($drupal_static_fast)) {
    $drupal_static_fast['piece_cache'] =& drupal_static('dmemcache_piece_cache', FALSE);
  }
  $piece_cache =& $drupal_static_fast['piece_cache'];
  if (!is_array($piece_cache)) {
    $piece_cache = dmemcache_get('__dmemcache_piece_cache');

    // On a website with no over-sized cache pieces, initialize the variable so
    // we never load it more than once per page versus once per DELETE.
    if (!is_array($piece_cache)) {
      dmemcache_set('__dmemcache_piece_cache', array());
    }
  }
  if (isset($piece_cache[$name])) {

    // Return the expiration time of the multi-piece cache item.
    return $piece_cache[$name];
  }

  // Item doesn't have multiple pieces.
  return FALSE;
}