You are here

function brightcove_cache_get in Brightcove Video Connect 7.3

Same name and namespace in other branches
  1. 7.7 brightcove.module \brightcove_cache_get()
  2. 7.4 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.

6 calls to brightcove_cache_get()
brightcove_get_playlists in ./brightcove.playlist.inc
Get the playlists from Brightcove.
brightcove_playlist_load in ./brightcove.module
brightcove_status in ./brightcove.module
Return the status of a specific video.
brightcove_video_load in ./brightcove.module
Loads Brightcove video from BC Media API. Uses a 5 minutes cache to speed up lookups.
_brightcove_field_playlist_browse in brightcove_field/brightcove_field.playlist.inc

... See full list

File

./brightcove.module, line 1202
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;
}