You are here

function ad_memcache_increment_map in Advertisement 6

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

Update mapping which allows us to quickly find stats in memcache when feeding them into the database.

1 call to ad_memcache_increment_map()
ad_cache_memcache_increment in cache/memcache/ad_cache_memcache.inc
Increment impressions counter in memcache.

File

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

Code

function ad_memcache_increment_map($action, $aid, $group, $hostid, $timestamp) {
  $key = "ad-counters-{$aid}";
  if (ad_memcache_lock($key)) {
    $counters = ad_memcache_get($key);
    if (!is_array($counters) || !isset($counters["{$action}:{$group}:{$hostid}:{$timestamp}"])) {
      $counters["{$action}:{$group}:{$hostid}:{$timestamp}"] = "{$action}:{$group}:{$hostid}:{$timestamp}";
      ad_memcache_set($key, $counters);
    }
    ad_memcache_unlock($key);
  }
}