Home > PHP > Function > Memcache > Memcache::decrement()

Memcache::decrement()

Memcache::decrement - Decrement item's value

Syntax

int Memcache::decrement (string $key, int $value)

Arguments

  • key - Key of the item do decrement.
  • value - Decrement the item by value.

Description

Memcache::decrement() decrements value of the item by value. Similarly to Memcache::increment(), current value of the item is being converted to numerical and after that value is substracted. Note: New item's value will not be less than zero. Note: Do not use Memcache::decrement() with item, which was stored compressed, because consequent call to Memcache::get() will fail. Memcache::decrement() does notcreate an item if it didn't exist. Also you can use memcache_decrement() function.

Version

PHP PECL memcache >= 0.2.0

Return value

Returns item's new value on success or FALSE on failure.