You are here

function _brightcove_delete_memcached in Brightcove Video Connect 7.7

Same name and namespace in other branches
  1. 7.3 brightcove.module \_brightcove_delete_memcached()
  2. 7.4 brightcove.module \_brightcove_delete_memcached()
  3. 7.5 brightcove.module \_brightcove_delete_memcached()
  4. 7.6 brightcove.module \_brightcove_delete_memcached()

Helper function to be able to delete outdated memcached items.

Parameters

$cid:

1 call to _brightcove_delete_memcached()
brightcove_invalidate_cache in ./brightcove.module
Invalidate outdated cache records.

File

./brightcove.module, line 3253
Brightcove module is an integration layer between any modules using Brightcove API. It makes all necessary checks for the API and makes settings available to the user.

Code

function _brightcove_delete_memcached($cid = NULL) {
  $cache_settings = variable_get('brightcove_cache_memcached', []);
  $location = isset($cache_settings['path']) ? $cache_settings['path'] : BRIGHTCOVE_CACHE_MEMCACHE_PATH;
  $port = isset($cache_settings['port']) ? $cache_settings['port'] : BRIGHTCOVE_CACHE_MEMCACHE_PORT;
  $memcached = new Memcached();
  $memcached
    ->addServer($location, $port);
  if ($cid) {
    $memcached
      ->delete($cid);
  }
  else {

    // Remove all cache item.
    $memcached
      ->flush();
  }
}