返回介绍

wp_cache_set()

发布于 2017-09-11 11:37:56 字数 4455 浏览 1049 评论 0 收藏 0

wp_cache_set( int|string $key,  mixed $data,  string $group = '',  int $expire )

Saves the data to the cache.


description

Differs from wp_cache_add() and wp_cache_replace() in that it will always write data.


参数

$key

(int|string) (Required) The cache key to use for retrieval later.

$data

(mixed) (Required) The contents to store in the cache.

$group

(string) (Optional) Where to group the cache contents. Enables the same key to be used across groups.

Default value: ''

$expire

(int) (Optional) When to expire the cache contents, in seconds. Default 0 (no expiration).


返回值

(bool) False on failure, true on success


源代码

File: wp-includes/cache.php

function wp_cache_set( $key, $data, $group = '', $expire = 0 ) {
	global $wp_object_cache;

	return $wp_object_cache->set( $key, $data, $group, (int) $expire );
}

更新日志

Versiondescription
2.0.0Introduced.

相关函数

Uses

  • wp-includes/cache.php: WP_Object_Cache::set()

Used By

  • wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::find_changeset_post_id()
  • wp-includes/functions.php: wp_cache_get_last_changed()
  • wp-includes/class-wp-term-query.php: WP_Term_Query::get_terms()
  • wp-includes/ms-blogs.php: clean_network_cache()
  • wp-includes/class-wp-site.php: WP_Site::get_details()
  • wp-includes/taxonomy.php: add_term_meta()
  • wp-includes/taxonomy.php: delete_term_meta()
  • wp-includes/taxonomy.php: update_term_meta()
  • wp-includes/class-wp-comment-query.php: WP_Comment_Query::fill_descendants()
  • wp-includes/option.php: update_network_option()
  • wp-includes/option.php: add_network_option()
  • wp-includes/option.php: get_network_option()
  • wp-admin/includes/class-wp-ms-sites-list-table.php: WP_MS_Sites_List_Table::column_users()
  • wp-admin/includes/plugin.php: get_plugins()
  • wp-includes/general-template.php: wp_get_archives()
  • wp-includes/general-template.php: get_calendar()
  • wp-includes/functions.php: is_blog_installed()
  • wp-includes/taxonomy.php: is_object_in_term()
  • wp-includes/taxonomy.php: clean_term_cache()
  • wp-includes/link-template.php: get_adjacent_post()
  • wp-includes/option.php: set_site_transient()
  • wp-includes/option.php: set_transient()
  • wp-includes/option.php: wp_load_core_site_options()
  • wp-includes/option.php: update_option()
  • wp-includes/option.php: add_option()
  • wp-includes/option.php: delete_option()
  • wp-includes/option.php: get_option()
  • wp-includes/post.php: clean_post_cache()
  • wp-includes/post.php: _get_last_post_time()
  • wp-includes/post.php: get_page_by_path()
  • wp-includes/post.php: get_pages()
  • wp-includes/post.php: wp_count_posts()
  • wp-includes/ms-functions.php: wpmu_create_blog()
  • wp-includes/ms-functions.php: get_blog_id_from_url()
  • wp-includes/bookmark.php: get_bookmarks()
  • wp-includes/ms-blogs.php: clean_blog_cache()
  • wp-includes/ms-blogs.php: get_blog_details()
  • wp-includes/comment.php: clean_comment_cache()
  • wp-includes/comment.php: wp_count_comments()
  • wp-includes/comment.php: get_lastcommentmodified()
  • Show 35 more used by Hide more used by

User Contributed Notes

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文