function ad_cache_memcache_increment in Advertisement 6
Same name and namespace in other branches
- 5.2 cache/memcache/ad_cache_memcache.inc \ad_cache_memcache_increment()
- 5 cache/memcache/ad_cache_memcache.inc \ad_cache_memcache_increment()
Increment impressions counter in memcache.
1 call to ad_cache_memcache_increment()
- ad_cache_memcache in cache/
memcache/ ad_cache_memcache.inc - Called by adserve.inc, display an ad from memcache.
File
- cache/
memcache/ ad_cache_memcache.inc, line 195 - Memcache include.
Code
function ad_cache_memcache_increment($action, $aid, $group = '', $hostid = '', $ad = array()) {
static $timestamp = NULL;
_debug_echo("Memcache: increment action({$action}) aid({$aid}) group({$group}) hostid({$hostid}).");
if ($aid && !is_object($ad)) {
_debug_echo("Invalid ad id: {$aid}.");
return 0;
}
if (!isset($timestamp)) {
$timestamp = date('YmdH');
}
$counters = ad_memcache_get("ad-counters-{$aid}");
$update = TRUE;
if (!is_array($counters) || !isset($counters["{$action}:{$group}:{$hostid}:{$timestamp}"])) {
_debug_echo("Memcache: adding map: action({$action}) aid({$aid}) group({$group}) hostid({$hostid}) timestamp({$timestamp})");
ad_memcache_increment_map($action, $aid, $group, $hostid, $timestamp);
}
$rc = ad_memcache_increment("ad-{$action}-{$aid}-{$group}-{$hostid}-{$timestamp}");
_debug_echo("Memcache: incrementing ad-{$action}-{$aid}-{$group}-{$hostid}-{$timestamp} ({$rc})");
}