You are here

function ad_cache_memcache_adserve_select in Advertisement 6

Same name and namespace in other branches
  1. 5.2 cache/memcache/ad_cache_memcache.inc \ad_cache_memcache_adserve_select()
  2. 5 cache/memcache/ad_cache_memcache.inc \ad_cache_memcache_adserve_select()

Allow external ad selection logic.

File

cache/memcache/ad_cache_memcache.inc, line 361
Memcache include.

Code

function ad_cache_memcache_adserve_select($ads, $invalid) {
  $cache = array();
  if ($select_func = ad_cache_memcache_hook($cache, 'include_file_select', 'include_func_select')) {
    _debug_echo("Memcache: adserve_select: invoking '{$select_func}()'");
    if (function_exists($select_func)) {
      if (is_array($cache) && !empty($cache)) {
        return $select_func($ads, $invalid, $cache);
      }
      else {
        _debug_echo("Memcache: unexpected error: cache empty.");
      }
    }
    else {
      _debug_echo("Memcache: adserve_select: '{$include_func_select}()' not found");
    }
  }
  else {
    _debug_echo("Memcache: adserve_select: no select function defined");
  }
}