WordPress как на ладони
Новые WordPress шаблоны Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru

wp transient

Добавляет, получает и удаляет записи во временном кэше WordPress.

By default, the transient cache uses the WordPress database to persist values between requests. On a single site installation, values are stored in the wp_options table. On a multisite installation, values are stored in the wp_options or the wp_sitemeta table, depending on use of the --network flag.

When a persistent object cache drop-in is installed (e.g. Redis or Memcached), the transient cache skips the database and simply wraps the WP Object Cache.

Список команд Описание
Возвращает временную опцию.
Устанавливает временную опцию.
Удаляет временную опцию.
Определяет тип применения временных опций.

Примеры

# Set transient.
$ wp transient set sample_key "test data" 3600
Success: Transient added.

# Get transient.
$ wp transient get sample_key
test data

# Delete transient.
$ wp transient delete sample_key
Success: Transient deleted.

# Delete expired transients.
$ wp transient delete --expired
Success: 12 expired transients deleted from the database.

# Delete all transients.
$ wp transient delete --all
Success: 14 transients deleted from the database.

Исходный код команд


wp transient get

Возвращает временную опцию.

For a more complete explanation of the transient cache, including the network|site cache, please see docs for wp transient.

Использование

wp transient get {key} [--format={format}] [--network]

Можно указать Глобальные параметры и следующие:

{key}
Key for the transient.
[--format={format}]

Render output in a particular format.
По умолчанию: table
Может быть:

  • table
  • csv
  • json
  • yaml
[--network]
Get the value of a network|site transient. On single site, this is is a specially-named cache key. On multisite, this is a global cache (instead of local to the site).

Примеры

$ wp transient get sample_key
test data
$ wp transient get random_key
Warning: Transient with key "random_key" is not set.
меню

wp transient set

Устанавливает временную опцию.

<expiration> is the time until expiration, in seconds.

For a more complete explanation of the transient cache, including the network|site cache, please see docs for wp transient.

Использование

wp transient set {key} {value} [{expiration}] [--network]

Можно указать Глобальные параметры и следующие:

{key}
Key for the transient.
{value}
Value to be set for the transient.
[{expiration}]
Time until expiration, in seconds.
[--network]
Set the value of a network|site transient. On single site, this is is a specially-named cache key. On multisite, this is a global cache (instead of local to the site).

Примеры

$ wp transient set sample_key "test data" 3600
Success: Transient added.
меню

wp transient delete

Удаляет временную опцию.

For a more complete explanation of the transient cache, including the network|site cache, please see docs for wp transient.

Использование

wp transient delete [{key}] [--network] [--all] [--expired]

Можно указать Глобальные параметры и следующие:

[{key}]
Key for the transient.
[--network]
Delete the value of a network|site transient. On single site, this is is a specially-named cache key. On multisite, this is a global cache (instead of local to the site).
[--all]
Delete all transients.
[--expired]
Delete all expired transients.

Примеры

# Delete transient.
$ wp transient delete sample_key
Success: Transient deleted.
# Delete expired transients.
$ wp transient delete --expired
Success: 12 expired transients deleted from the database.
# Delete all transients.
$ wp transient delete --all
Success: 14 transients deleted from the database.
меню

wp transient type

Определяет тип применения временных опций.

Indicates whether the transients API is using an object cache or the options table.

For a more complete explanation of the transient cache, including the network|site cache, please see docs for wp transient.

Использование

wp transient type 

Примеры

$ wp transient type
Transients are saved to the wp_options table.
Комментариев нет
    Здравствуйте, !     Войти . Зарегистрироваться