Automattic\WooCommerce\Internal\Caches
VersionStringGenerator::store_version
Store the version string in cache with a filterable TTL.
Method of the class: VersionStringGenerator{}
Hooks from the method
Returns
true|false. True on success, false on failure.
Usage
// protected - for code of main (parent) or child class $result = $this->store_version( $id, $version ): bool;
- $id(string) (required)
- The ID to store the version string for.
- $version(string) (required)
- The version string to store.
VersionStringGenerator::store_version() VersionStringGenerator::store version code WC 10.4.3
protected function store_version( string $id, string $version ): bool {
$cache_key = $this->get_cache_key( $id );
/**
* Filter the TTL for version string cache.
*
* @param int $ttl Time to live in seconds. Default 1 day.
* @param string $id The ID.
*
* @since 10.4.0
*/
$ttl = apply_filters( 'woocommerce_version_string_generator_ttl', DAY_IN_SECONDS, $id );
$ttl = max( 0, (int) $ttl );
return wp_cache_set( $cache_key, $version, self::CACHE_GROUP, $ttl );
}