protected static function handle_transient_locking($slug, $callback, $transient_time, $lock_timeout, $force, $enable_transients)
{
if ($enable_transients && self::_is_transient_locked($slug)) {
$force = apply_filters('timber_force_transients', $force);
$force = apply_filters('timber_force_transient_' . $slug, $force);
if (!$force) {
//the server is currently executing the process.
//We're just gonna dump these users. Sorry!
return false;
}
$enable_transients = false;
}
// lock timeout shouldn't be higher than 5 seconds, unless
// remote calls with high timeouts are made here
if ($enable_transients) {
self::_lock_transient($slug, $lock_timeout);
}
$data = $callback();
if ($enable_transients) {
set_transient($slug, $data, $transient_time);
self::_unlock_transient($slug);
}
return $data;
}