钩子文档

wp_cache_set_last_changed

💡 云策文档标注

概述

wp_cache_set_last_changed 是一个 WordPress Hook,在缓存组的 last_changed 时间更新后触发。它用于通知开发者缓存组状态的变化,以便执行相关操作。

关键要点

  • 这是一个动作 Hook,在缓存组 last_changed 时间更新后触发。
  • 每次页面加载可能触发多次,因此注册的动作必须高效。
  • Hook 参数包括缓存组名称、新的 last_changed 时间和之前的 last_changed 时间(如果未设置则为 false)。
  • 相关函数 wp_cache_set_last_changed() 用于设置缓存组的 last_changed 时间为当前时间。
  • 从 WordPress 6.3.0 版本开始引入。

📄 原文内容

Fires after a cache group last_changed time is updated.

Description

This may occur multiple times per page load and registered actions must be performant.

Parameters

$groupstring
The cache group name.
$timestring
The new last changed time (msec sec).
$previous_timestring|false
The previous last changed time. False if not previously set.

Source

do_action( 'wp_cache_set_last_changed', $group, $time, $previous_time );

Changelog

Version Description
6.3.0 Introduced.