Yoast\WP\SEO\Expiring_Store\Application
Expiring_Store::persist_if_absent_for_user
Persists a value scoped to a user, only if the key does not already exist.
Метод класса: Expiring_Store{}
Хуков нет.
Возвращает
true|false. True if the value was inserted, false if the key already exists.
Использование
$Expiring_Store = new Expiring_Store(); $Expiring_Store->persist_if_absent_for_user( $key, $value, $ttl_in_seconds, $user_id ): bool;
- $key(строка) (обязательный)
- The key.
- $value(scalar|array<string|int|float|true|false|массив|null>|JsonSerializable) (обязательный)
- The value to store.
- $ttl_in_seconds(int) (обязательный)
- The time-to-live in seconds.
- $user_id(int)
- The user ID.
По умолчанию:current user
Код Expiring_Store::persist_if_absent_for_user() Expiring Store::persist if absent for user Yoast 27.7
public function persist_if_absent_for_user( string $key, $value, int $ttl_in_seconds, int $user_id = 0 ): bool {
return $this->do_persist_if_absent( $this->prefix_for_user( $key, $user_id ), $value, $ttl_in_seconds );
}