You are here

function adserve_cache_get_cache in Advertisement 5.2

Same name and namespace in other branches
  1. 6.3 adcache.inc \adserve_cache_get_cache()
  2. 6.2 adcache.inc \adserve_cache_get_cache()
  3. 7 adcache.inc \adserve_cache_get_cache()

Build and return the cache. TODO: It's expensive to build the cache each time we serve an ad, this should be cached in the database, not in a static.

File

./adcache.inc, line 152

Code

function adserve_cache_get_cache($data = NULL) {
  static $cache = NULL;

  // if we don't the the cache yet, build it
  if (is_null($cache)) {
    $cache = module_invoke_all('ad_build_cache');
  }
  if ($data) {
    if (isset($cache[$data])) {
      return $cache[$data];
    }
    else {
      return NULL;
    }
  }
  return $cache;
}