本文整理汇总了PHP中wp_cache_reset函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_cache_reset函数的具体用法?PHP wp_cache_reset怎么用?PHP wp_cache_reset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_cache_reset函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switch_to_blog
/**
* Cache-safe switching in case any multi-site hiccups might occur.
* Clears the cache after switching to the given blog to avoid using
* another blog's cached values.
* See wp_cache_reset() in wp-includes/cache.php
* @see wp_cache_reset()
* @link http://core.trac.wordpress.org/ticket/14941
*
* @param int $blog_id
*/
public static function switch_to_blog($blog_id)
{
switch_to_blog($blog_id);
if (function_exists('wp_cache_switch_to_blog')) {
wp_cache_switch_to_blog($blog_id);
// introduced in WP 3.5.0
} else {
wp_cache_reset();
// deprecated in WP 3.5.0
}
}
示例2: wp_start_object_cache
/**
* Starts the WordPress object cache.
*
* If an object-cache.php file exists in the wp-content directory,
* it uses that drop-in as an external object cache.
*
* @access private
* @since 3.0.0
*/
function wp_start_object_cache()
{
global $_wp_using_ext_object_cache;
$first_init = false;
if (!function_exists('wp_cache_init')) {
if (file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
require_once WP_CONTENT_DIR . '/object-cache.php';
$_wp_using_ext_object_cache = true;
} else {
require_once ABSPATH . WPINC . '/cache.php';
$_wp_using_ext_object_cache = false;
}
$first_init = true;
} else {
if (!$_wp_using_ext_object_cache && file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
// Sometimes advanced-cache.php can load object-cache.php before it is loaded here.
// This breaks the function_exists check above and can result in $_wp_using_ext_object_cache
// being set incorrectly. Double check if an external cache exists.
$_wp_using_ext_object_cache = true;
}
}
// If cache supports reset, reset instead of init if already initialized.
// Reset signals to the cache that global IDs have changed and it may need to update keys
// and cleanup caches.
if (!$first_init && function_exists('wp_cache_reset')) {
wp_cache_reset();
} else {
wp_cache_init();
}
if (function_exists('wp_cache_add_global_groups')) {
wp_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'user_meta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts'));
wp_cache_add_non_persistent_groups(array('comment', 'counts', 'plugins'));
}
}
示例3: test_password_reset__normal
/**
* @depends test_save_verified_ip__overflow
*/
public function test_password_reset__normal()
{
global $wpdb;
$ip = '3.4.5.6';
$_SERVER['REMOTE_ADDR'] = $ip;
$actual = self::$lss->password_reset($this->user, 'some 1 Needs!');
$this->assertNull($actual, 'password_reset() should return null.');
// Check the outcome.
$actual = self::$lss->get_verified_ips($this->user->ID);
$this->assertSame(array($ip), $actual, 'Expected IP was not found.');
$wpdb->query('ROLLBACK TO empty');
wp_cache_reset();
}
示例4: switch_to_blog
/**
* Cache-safe switching in case any multi-site hiccups might occur.
* Clears the cache after switching to the given blog to avoid using
* another blog's cached values.
* See wp_cache_reset() in wp-includes/cache.php
* @see wp_cache_reset()
* @link http://core.trac.wordpress.org/ticket/14941
*
* @param int $blog_id
*/
public static function switch_to_blog($blog_id)
{
switch_to_blog($blog_id);
wp_cache_reset();
}
示例5: affiliates_deactivate
/**
* Drop tables and clear data if the plugin is deactivated.
* This will happen only if the user chooses to delete data upon deactivation.
*/
function affiliates_deactivate($network_wide = false)
{
if (is_multisite() && $network_wide) {
if (get_option('aff_delete_network_data', false)) {
$blog_ids = affiliates_get_blogs();
foreach ($blog_ids as $blog_id) {
switch_to_blog($blog_id);
wp_cache_reset();
affiliates_cleanup(true);
restore_current_blog();
}
}
} else {
affiliates_cleanup();
}
}
示例6: wp_start_object_cache
/**
* Starts the WordPress object cache.
*
* If an object-cache.php file exists in the wp-content directory,
* it uses that drop-in as an external object cache.
*
* @access private
* @since 3.0.0
*/
function wp_start_object_cache()
{
$first_init = false;
if (!function_exists('wp_cache_init')) {
global $_wp_using_ext_object_cache;
if (file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
require_once WP_CONTENT_DIR . '/object-cache.php';
$_wp_using_ext_object_cache = true;
} else {
require_once ABSPATH . WPINC . '/cache.php';
$_wp_using_ext_object_cache = false;
}
$first_init = true;
}
// If cache supports reset, reset instead of init if already initialized.
// Reset signals to the cache that global IDs have changed and it may need to update keys
// and cleanup caches.
if (!$first_init && function_exists('wp_cache_reset')) {
wp_cache_reset();
} else {
wp_cache_init();
}
if (function_exists('wp_cache_add_global_groups')) {
wp_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts'));
wp_cache_add_non_persistent_groups(array('comment', 'counts', 'plugins'));
}
}
示例7: delete_blog
/**
* Clean up for a given blog.
*
* @param int $blog_id
* @param boolean $drop
*/
public static function delete_blog($blog_id, $drop = false)
{
if (is_multisite()) {
if (self::is_sitewide_plugin()) {
switch_to_blog($blog_id);
wp_cache_reset();
self::cleanup($drop);
restore_current_blog();
}
}
}