Yoast\WP\SEO\Expiring_Store\Infrastructure
WPDB_Expiring_Store_Repository::upsert
Inserts or replaces a value in the expiring store.
Метод класса: WPDB_Expiring_Store_Repository{}
Хуков нет.
Возвращает
void. Ничего (null).
Использование
$WPDB_Expiring_Store_Repository = new WPDB_Expiring_Store_Repository(); $WPDB_Expiring_Store_Repository->upsert( $key, $json_value, $expiration_datetime ): void;
- $key(строка) (обязательный)
- The key to store.
- $json_value(строка) (обязательный)
- The JSON-encoded value.
- $expiration_datetime(строка) (обязательный)
- The expiration datetime in
'Y-m-d H:i:s'format.
Код WPDB_Expiring_Store_Repository::upsert() WPDB Expiring Store Repository::upsert Yoast 28.9
public function upsert( string $key, string $json_value, string $expiration_datetime ): void {
global $wpdb;
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- Custom table with no caching layer.
$wpdb->replace(
$this->get_table_name(),
[
'key_name' => $key,
'value' => $json_value,
'exp' => $expiration_datetime,
],
[ '%s', '%s', '%s' ],
);
}