function ad_memcache_decrement in Advertisement 5
Same name and namespace in other branches
- 5.2 cache/memcache/ad_cache_memcache.inc \ad_memcache_decrement()
- 6 cache/memcache/ad_cache_memcache.inc \ad_memcache_decrement()
Decrement a numerical value in memcache.
1 call to ad_memcache_decrement()
- ad_cache_memcache_sync_ad in cache/
memcache/ ad_cache_memcache.module - Syncronize counts for given advertisement with database.
File
- cache/
memcache/ ad_cache_memcache.inc, line 304
Code
function ad_memcache_decrement($key, $value = 1) {
$memcache = ad_memcache_init();
$rc = $memcache
->decrement($key, $value);
if ($rc === FALSE) {
// We tried incrementing a counter that hasn't yet been initialized.
$rc = $memcache
->set($key, $value);
if ($rc === FALSE) {
// Another process already initialized the counter, increment it.
$rc = $memcache
->decrement($key);
}
}
return $rc;
}