wp_cache_close()
云策文档标注
概述
wp_cache_close() 函数用于关闭缓存,但自 WordPress 2.5 起已无实际功能,仅返回 true。插件仍可自定义实现此函数以确保缓存清理。
关键要点
- wp_cache_close() 自 WordPress 2.5 起不再执行任何操作,因为持久缓存功能已被移除。
- 该函数始终返回 true,插件可重写它以在 WordPress 不再需要时清理缓存。
- 函数定义简单:function wp_cache_close() { return true; }。
代码示例
function wp_cache_close() {
return true;
}注意事项
此函数主要用于向后兼容,插件开发者应了解其历史背景,并根据需要自定义实现。
原文内容
Closes the cache.
Description
This function has ceased to do anything since WordPress 2.5. The functionality was removed along with the rest of the persistent cache.
This does not mean that plugins can’t implement this function when they need to make sure that the cache is cleaned up after WordPress no longer needs it.
Source
function wp_cache_close() {
return true;
}
Changelog
| Version | Description |
|---|---|
| 2.0.0 | Introduced. |