You are here

function ad_cache_memcache_sync in Advertisement 6

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

Load advertisements into memory.

2 calls to ad_cache_memcache_sync()
ad_cache_memcache_adcacheapi in cache/memcache/ad_cache_memcache.module
Implementation of hook_adcacheapi().
ad_cache_memcache_cron in cache/memcache/ad_cache_memcache.module
Regularily syncronize counters into RAM.
2 string references to 'ad_cache_memcache_sync'
ad_cache_memcache_adcacheapi in cache/memcache/ad_cache_memcache.module
Implementation of hook_adcacheapi().
ad_cache_memcache_cron in cache/memcache/ad_cache_memcache.module
Regularily syncronize counters into RAM.

File

cache/memcache/ad_cache_memcache.module, line 143
A plug in for the ad.module, integrating the ad module with memcache.

Code

function ad_cache_memcache_sync() {
  variable_set('ad_memcache_timestamp', time());
  if (($error = ad_cache_memcache_requirements()) === TRUE) {
    $result = db_query("SELECT aid, adtype FROM {ads} WHERE adstatus = 'active'");
    while ($ad = db_fetch_object($result)) {
      ad_cache_memcache_sync_ad($ad->aid);
    }

    // Sync counters.
    ad_cache_memcache_sync_ad(0);
  }
  else {
    drupal_set_message(t('!module: Unable to syncronize cache: !error', array(
      '!module' => 'ad_cache_memcache.module',
      '!error' => $error,
    )), 'error');
  }
}