You are here

function brightcove_invalidate_cache in Brightcove Video Connect 7.7

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

Invalidate outdated cache records.

Parameters

$cid:

bool $wildcard:

3 calls to brightcove_invalidate_cache()
BrightcovePlaylistEntityController::delete in ./brightcove.playlist.inc
Overwrites DrupalDefaultEntityController::delete().
BrightcovePlaylistEntityController::save in ./brightcove.playlist.inc
Overwrites EntityAPIController::save().
brightcove_save_video in ./brightcove.video.inc
Saves a Video.

File

./brightcove.module, line 3189
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_invalidate_cache($cid, $wildcard = FALSE) {

  // If cache is enabled.
  if (variable_get('brightcove_cache_enabled', TRUE)) {

    // Get the type of cache being set.
    $type = variable_get('brightcove_cache_type', 'db');
    switch ($type) {
      case 'db':
        cache_clear_all($cid, 'cache_brightcove', $wildcard);
        break;
      case 'file':
        if ($wildcard) {

          // Remove all the cache files, when new file is added or an existing one is deleted, because we can't use
          // wildcard like we can when we cache to database.
          _brightcove_delete_cache_files();
        }
        else {
          _brightcove_delete_cache_files($cid);
        }
        break;
      case 'memcached':
        if ($wildcard) {

          // Remove all the cache files, when new file is added or an existing one is deleted, because we can't use
          // wildcard like we can when we cache to database.
          _brightcove_delete_memcached();
        }
        else {
          _brightcove_delete_memcached($cid);
        }
        break;
    }
  }
}