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.


Top ↑

Parameters Parameters

$group

(string) (Required) Cache group name.


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/class.llms.cache.helper.php

80
81
82
83
84
85
86
87
88
89
90
91
92
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 );
 
}


Top ↑

Changelog Changelog

Changelog
Version Description
4.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.