You are here

function dmemcache_piece_cache_get in Memcache API and Integration 6

Same name and namespace in other branches
  1. 7 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 840

Code

function dmemcache_piece_cache_get($name) {
  static $dmemcache_static_fast;
  if (!isset($dmemcache_static_fast)) {
    $dmemcache_static_fast['piece_cache'] =& dmemcache_static('dmemcache_piece_cache', FALSE);
  }
  $piece_cache =& $dmemcache_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;
}