Timber\Helper::transient PHP Метод

transient() публичный статический Метод

A utility for a one-stop shop for Transients
public static transient ( string $slug, callable $callback, integer $transient_time, integer $lock_timeout = 5, boolean $force = false ) : mixed
$slug string Unique identifier for transient
$callback callable Callback that generates the data that's to be cached
$transient_time integer (optional) Expiration of transients in seconds
$lock_timeout integer (optional) How long (in seconds) to lock the transient to prevent race conditions
$force boolean (optional) Force callback to be executed when transient is locked
Результат mixed
    public static function transient($slug, $callback, $transient_time = 0, $lock_timeout = 5, $force = false)
    {
        $slug = apply_filters('timber/transient/slug', $slug);
        $enable_transients = $transient_time === false || defined('WP_DISABLE_TRANSIENTS') && WP_DISABLE_TRANSIENTS ? false : true;
        $data = $enable_transients ? get_transient($slug) : false;
        if (false === $data) {
            $data = self::handle_transient_locking($slug, $callback, $transient_time, $lock_timeout, $force, $enable_transients);
        }
        return $data;
    }