tribe_get_next_cached_increment( string $key, string $expiration_trigger = '', int $default )
Get the next increment of a cached incremental value.
Contents
Parameters
- $key
-
(string) (Required) Cache key for the incrementor.
- $expiration_trigger
-
(string) (Optional) The trigger that causes the cache key to expire.
Default value: ''
- $default
-
(int) (Required) The default value of the incrementor.
Return
(int)
Source
File: src/functions/utils.php
function tribe_get_next_cached_increment( $key, $expiration_trigger = '', $default = 0 ) {
$cache = tribe( 'cache' );
$value = (int) $cache->get( $key, $expiration_trigger, $default );
$value++;
$cache->set( $key, $value, \Tribe__Cache::NON_PERSISTENT, $expiration_trigger );
return $value;
}
Changelog
| Version | Description |
|---|---|
| 4.14.7 | Introduced. |