wp_cache_set() - WordPress 函数参考中文文档

返回介绍

wp_cache_set()

发布于 2017-09-11 字数4457 浏览 983 评论 0

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

Saves the data to the cache.


描述

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 );
}

更新日志

Version 描述
2.0.0 Introduced.

相关函数

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!