Uses
Uses | Description |
---|---|
wp-includes/class-wp-object-cache.php: WP_Object_Cache::_exists() | Serves as a utility function to determine whether a key exists in the cache. |
Increments numeric cache item’s value.
(int|string) (Required) The cache key to increment
(int) (Optional) The amount by which to increment the item's value.
Default value: 1
(string) (Optional) The group the key is in.
Default value: 'default'
(int|false) The item's new value on success, false on failure.
File: wp-includes/class-wp-object-cache.php
public function incr( $key, $offset = 1, $group = 'default' ) { if ( empty( $group ) ) { $group = 'default'; } if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) { $key = $this->blog_prefix . $key; } if ( ! $this->_exists( $key, $group ) ) { return false; } if ( ! is_numeric( $this->cache[ $group ][ $key ] ) ) { $this->cache[ $group ][ $key ] = 0; } $offset = (int) $offset; $this->cache[ $group ][ $key ] += $offset; if ( $this->cache[ $group ][ $key ] < 0 ) { $this->cache[ $group ][ $key ] = 0; } return $this->cache[ $group ][ $key ]; }
Version | Description |
---|---|
3.3.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_object_cache/incr