当前位置: 首页>>代码示例>>PHP>>正文


PHP wp_cache_add_non_persistent_groups函数代码示例

本文整理汇总了PHP中wp_cache_add_non_persistent_groups函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_cache_add_non_persistent_groups函数的具体用法?PHP wp_cache_add_non_persistent_groups怎么用?PHP wp_cache_add_non_persistent_groups使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wp_cache_add_non_persistent_groups函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadAllOptions

 public static function loadAllOptions()
 {
     global $wpdb;
     $options = wp_cache_get('alloptions', 'wordfence');
     if (!$options) {
         $table = self::table();
         self::updateTableExists();
         $suppress = $wpdb->suppress_errors();
         if (!($rawOptions = $wpdb->get_results("SELECT name, val FROM {$table} WHERE autoload = 'yes'"))) {
             $rawOptions = $wpdb->get_results("SELECT name, val FROM {$table}");
         }
         $wpdb->suppress_errors($suppress);
         $options = array();
         foreach ((array) $rawOptions as $o) {
             if (in_array($o->name, self::$serializedOptions)) {
                 $val = maybe_unserialize($o->val);
                 if ($val) {
                     $options[$o->name] = $val;
                 }
             } else {
                 $options[$o->name] = $o->val;
             }
         }
         wp_cache_add_non_persistent_groups('wordfence');
         wp_cache_add('alloptions', $options, 'wordfence');
     }
     return $options;
 }
开发者ID:adamplabarge,项目名称:bermstyle,代码行数:28,代码来源:wfConfig.php

示例2: __construct

 /**
  * PHP 5 constructor
  *
  * @since 1.0-beta
  */
 function __construct()
 {
     // Define post type and taxonomy names for use in the register functions
     $this->post_type_name = apply_filters('bp_docs_post_type_name', 'bp_doc');
     $this->associated_item_tax_name = apply_filters('bp_docs_associated_item_tax_name', 'bp_docs_associated_item');
     $this->access_tax_name = apply_filters('bp_docs_access_tax_name', 'bp_docs_access');
     // :'(
     wp_cache_add_non_persistent_groups(array('bp_docs_nonpersistent'));
     // Let plugins know that BP Docs has started loading
     add_action('plugins_loaded', array($this, 'load_hook'), 20);
     // Load predefined constants first thing
     add_action('bp_docs_load', array($this, 'load_constants'), 2);
     // Includes necessary files
     add_action('bp_docs_load', array($this, 'includes'), 4);
     // Load the BP Component extension
     add_action('bp_docs_load', array($this, 'do_integration'), 6);
     // Load textdomain
     add_action('bp_docs_load', array($this, 'load_plugin_textdomain'));
     // Let other plugins know that BP Docs has finished initializing
     add_action('bp_init', array($this, 'init_hook'));
     // Hooks into the 'init' action to register our WP custom post type and tax
     add_action('bp_docs_init', array($this, 'register_post_type'), 2);
     add_action('bp_docs_init', array(&$this, 'add_rewrite_tags'), 4);
     // Set up doc taxonomy, etc
     add_action('bp_docs_init', array($this, 'load_doc_extras'), 8);
     // Add rewrite rules
     add_action('generate_rewrite_rules', array(&$this, 'generate_rewrite_rules'));
     // parse_query
     add_action('parse_query', array($this, 'parse_query'));
     // Protect doc access
     add_action('template_redirect', array($this, 'protect_doc_access'));
     add_action('admin_init', array($this, 'flush_rewrite_rules'));
 }
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:38,代码来源:bp-docs.php

示例3: __construct

 function __construct()
 {
     // vars
     $this->cache = array();
     $this->reference = array();
     // prevent ACF from persistent cache
     wp_cache_add_non_persistent_groups('acf');
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:8,代码来源:cache.php

示例4: add_non_persistent_groups

 /**
  * Adds a non-persistent group to the list.
  *
  * @uses	wp_cache_add_non_persistent_groups
  *
  * @param 	array 			$args				Function arguments.
  * @param 	array 			$assoc_args			Function arguments with parameter key.
  * @return	void
  */
 public function add_non_persistent_groups($args, $assoc_args)
 {
     if (empty($args)) {
         WP_CLI::line('usage: wp cache add_non_persistent_groups <group>');
         exit;
     }
     $group = $args[0];
     wp_cache_add_non_persistent_groups($group);
 }
开发者ID:rpeterson,项目名称:wp-cli,代码行数:18,代码来源:cache.php

示例5: init

 function init()
 {
     //Add non-persistent cache group
     wp_cache_add_non_persistent_groups(self::SLUG);
     //Registers GET listener to toggle setting
     $this->register_endpoints();
     //Message if WPML installed
     if ($this->wpml_installed()) {
         add_action('admin_notices', array($this, 'admin_notices'));
     }
 }
开发者ID:rustemcaushi,项目名称:hesk11.com,代码行数:11,代码来源:english-wp-admin.php

示例6: __construct

 /**
  * Constructor.
  *
  * @since 1.9
  */
 public function __construct()
 {
     if (!bp_docs_enable_folders()) {
         return;
     }
     $this->register_post_type();
     $this->register_taxonomies();
     // It is my hope and dream that this will one day be persistent.
     wp_cache_add_non_persistent_groups(array('bp_docs_folders'));
     add_action('bp_docs_enqueue_scripts', array($this, 'enqueue_assets'));
     $this->setup_hooks();
 }
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:17,代码来源:addon-folders.php

示例7: flush_cache

	function flush_cache() {
		global $wp_object_cache;
		$wp_object_cache->group_ops = array();
		$wp_object_cache->stats = array();
		$wp_object_cache->memcache_debug = array();
		$wp_object_cache->cache = array();
		if ( method_exists( $wp_object_cache, '__remoteset' ) ) {
			$wp_object_cache->__remoteset();
		}
		wp_cache_flush();
		wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache' ) );
		wp_cache_add_non_persistent_groups( array( 'comment', 'counts', 'plugins' ) );
	}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:13,代码来源:testcase.php

示例8: init

 public function init()
 {
     wp_cache_add_non_persistent_groups('my-wp-backup');
     add_action('admin_post_MyWPBackup_settings', array($this, 'post_settings'));
     add_action('admin_post_MyWPBackup_import', array($this, 'post_import'));
     add_action(is_multisite() ? 'network_admin_notices' : 'admin_notices', array($this, 'admin_notice'));
     global $current_user;
     $user_id = $current_user->ID;
     if (is_multisite() && is_network_admin() || !is_multisite() && current_user_can('manage_options')) {
         if ('1' === filter_input(INPUT_GET, 'mwpb_notice_close', FILTER_SANITIZE_NUMBER_INT)) {
             add_user_meta($user_id, 'mwpb-notice-1', 'true', true);
         }
     }
     Job::get_instance();
     Backup::get_instance();
 }
开发者ID:akochnov,项目名称:fts,代码行数:16,代码来源:Admin.php

示例9: add_cache_groups

 public function add_cache_groups()
 {
     if (function_exists('wp_cache_add_non_persistent_groups')) {
         wp_cache_add_non_persistent_groups(array('bu-navigation'));
     }
 }
开发者ID:iamapioneer,项目名称:sdas,代码行数:6,代码来源:bu-navigation.php

示例10: cacsp_add_non_persistent_cache_group

/**
 * Add our non-persistent cache group.
 *
 * BuddyPress does not have decent (any) cache support for groups-of-member queries. Adding a
 * non-persistent group here so that we don't have to worry about invalidation. At least this
 * will help with single pages.
 */
function cacsp_add_non_persistent_cache_group()
{
    wp_cache_add_non_persistent_groups(array('cacsp_groups_of_user'));
}
开发者ID:sheesh,项目名称:social-paper,代码行数:11,代码来源:hooks-buddypress-group.php

示例11: 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'));
    }
}
开发者ID:beaucollins,项目名称:wp,代码行数:36,代码来源:load.php

示例12: wp_start_object_cache

/**
 * Start 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.
 *
 * @since 3.0.0
 * @access private
 *
 * @global int $blog_id Blog ID.
 */
function wp_start_object_cache()
{
    global $blog_id;
    $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';
            if (function_exists('wp_cache_init')) {
                wp_using_ext_object_cache(true);
            }
        }
        $first_init = true;
    } elseif (!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 (!wp_using_ext_object_cache()) {
        require_once ABSPATH . WPINC . '/cache.php';
    }
    /*
     * 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_switch_to_blog')) {
        wp_cache_switch_to_blog($blog_id);
    } elseif (function_exists('wp_cache_init')) {
        wp_cache_init();
    }
    if (function_exists('wp_cache_add_global_groups')) {
        wp_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache'));
        wp_cache_add_non_persistent_groups(array('comment', 'counts', 'plugins'));
    }
}
开发者ID:hughnet,项目名称:WordPress,代码行数:50,代码来源:load.php

示例13: 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'));
    }
}
开发者ID:laiello,项目名称:qinhan,代码行数:43,代码来源:load.php

示例14: restore_current_blog

function restore_current_blog()
{
    global $table_prefix, $wpdb, $blog_id, $switched, $switched_stack, $wp_roles, $wp_object_cache;
    if (!$switched) {
        return false;
    }
    if (!is_array($switched_stack)) {
        return false;
    }
    $blog = array_pop($switched_stack);
    if ($blog_id == $blog) {
        do_action('switch_blog', $blog, $blog);
        /* If we still have items in the switched stack, consider ourselves still 'switched' */
        $switched = is_array($switched_stack) && count($switched_stack) > 0;
        return true;
    }
    $wpdb->set_blog_id($blog);
    $prev_blog_id = $blog_id;
    $blog_id = $blog;
    $table_prefix = $wpdb->prefix;
    if (is_object($wp_roles)) {
        $wpdb->suppress_errors();
        if (method_exists($wp_roles, '_init')) {
            $wp_roles->_init();
        } elseif (method_exists($wp_roles, '__construct')) {
            $wp_roles->__construct();
        }
        $wpdb->suppress_errors(false);
    }
    if (did_action('init')) {
        $current_user = wp_get_current_user();
        if (is_object($current_user)) {
            $current_user->for_blog($blog_id);
        }
    }
    if (is_object($wp_object_cache) && isset($wp_object_cache->global_groups)) {
        $global_groups = $wp_object_cache->global_groups;
    } else {
        $global_groups = false;
    }
    wp_cache_init();
    if (function_exists('wp_cache_add_global_groups')) {
        if (is_array($global_groups)) {
            wp_cache_add_global_groups($global_groups);
        } else {
            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'));
    }
    do_action('switch_blog', $blog_id, $prev_blog_id);
    /* If we still have items in the switched stack, consider ourselves still 'switched' */
    $switched = is_array($switched_stack) && count($switched_stack) > 0;
    return true;
}
开发者ID:junxuan,项目名称:wordpress,代码行数:54,代码来源:ms-blogs.php

示例15: wp_cache_add_non_persistent_groups

<?php

/**
 * Turn off persistent caching for users.
 *
 * We use memcached for GlotPress because query calculations are very heavy and slow.
 *
 * However some issues were noticed with persistent user caching (very likely due to the WP.org setup)
 * so this turns it off. User queries in GlotPress are comparatively very light.
 *
 * We should test this and remove this plugin at a later date.
 *
 * @author Nacin
 */
wp_cache_add_non_persistent_groups(array('users', 'userlogins', 'usermeta', 'usermail', 'usernicename'));
开发者ID:serhi,项目名称:wordpress-sites,代码行数:15,代码来源:wporg-non-persistent-users.php


注:本文中的wp_cache_add_non_persistent_groups函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。