LLMS_Cache_Helper::get_prefix( string $group )
Retrieve a cache prefix that can be used with WP_Object_Cache methods
Description Description
Using a cache prefix allows simple invalidation of all items with the same prefix simply by updating the prefix.
The "prefix" is microtime(), if we wish to invalidate all items in the prefix group we call the method again with $invalidate=true
which updates the prefix to the current microtime(), thereby invalidating the entire cache group.
Parameters Parameters
- $group
-
(string) (Required) Cache group name.
Return Return
(string)
Source Source
File: includes/class.llms.cache.helper.php
public static function get_prefix( $group ) { $key = sprintf( 'llms_%s_cache_prefix', $group ); $prefix = wp_cache_get( $key, $group ); if ( false === $prefix ) { $prefix = microtime(); wp_cache_set( $key, $prefix, $group ); } return sprintf( 'llms_cache_%s_', $prefix ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
4.0.0 | Introduced. |