You are here

function brightcove_cache_get in Brightcove Video Connect 7.4

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

Return the cached data based on the type of the caching.

Parameters

$cid: The id of the cache.

Return value

mixed The cached data, if exists, FALSE otherwise.

8 calls to brightcove_cache_get()
brightcove_get_playlists in ./brightcove.playlist.inc
Get the playlists from Brightcove.
brightcove_media_list in brightcove_media/brightcove_media.module
Get the avaliable videos from brightcove.
brightcove_media_playlist_list in brightcove_media/brightcove_media.module
brightcove/media/playlist/list menu callback function.
brightcove_playlist_load in ./brightcove.module
brightcove_status in ./brightcove.module
Return the status of a specific video.

... See full list

File

./brightcove.module, line 1169
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_cache_get($cid) {

  // 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 = cache_get($cid, 'cache_brightcove');
        if ($cache) {
          return $cache->data;
        }
        break;
      case 'file':
      case 'memcached':
        $bc_cache = brightcove_cache_initialize();
        $cache = $bc_cache
          ->get($cid);
        return json_decode($cache, TRUE);
        break;
    }
  }
  return FALSE;
}