當前位置: 首頁>>代碼示例>>PHP>>正文


PHP wp_cache_add_global_groups函數代碼示例

本文整理匯總了PHP中wp_cache_add_global_groups函數的典型用法代碼示例。如果您正苦於以下問題:PHP wp_cache_add_global_groups函數的具體用法?PHP wp_cache_add_global_groups怎麽用?PHP wp_cache_add_global_groups使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了wp_cache_add_global_groups函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: bootstrap

/**
 * Bootstrap the plugin and get it started!
 */
function bootstrap()
{
    wp_cache_add_global_groups(array('cavalcade'));
    if (!is_installed()) {
        create_tables();
    }
}
開發者ID:pewresearch,項目名稱:Cavalcade,代碼行數:10,代碼來源:plugin.php

示例2: startup

/**
 * Attach Mercator into WordPress
 *
 * Imagine this as attaching the strings to the puppet.
 */
function startup()
{
    // Define the table variables
    if (empty($GLOBALS['wpdb']->dmtable)) {
        $GLOBALS['wpdb']->dmtable = $GLOBALS['wpdb']->base_prefix . 'domain_mapping';
        $GLOBALS['wpdb']->ms_global_tables[] = 'domain_mapping';
    }
    // Ensure cache is shared
    wp_cache_add_global_groups(array('domain_mapping', 'network_mapping'));
    // Actually hook in!
    add_filter('pre_get_site_by_path', __NAMESPACE__ . '\\check_domain_mapping', 10, 2);
    add_action('admin_init', __NAMESPACE__ . '\\load_admin', -100);
    add_action('delete_blog', __NAMESPACE__ . '\\clear_mappings_on_delete');
    add_action('muplugins_loaded', __NAMESPACE__ . '\\register_mapped_filters', -10);
    // Add CLI commands
    if (defined('WP_CLI') && WP_CLI) {
        WP_CLI::add_command('mercator mapping', __NAMESPACE__ . '\\CLI\\Mapping_Command');
        WP_CLI::add_command('mercator network-mapping', __NAMESPACE__ . '\\CLI\\Network_Mapping_Command');
    }
    /**
     * Fired after Mercator core has been loaded
     *
     * Hook into this to handle any add-on functionality.
     */
    do_action('mercator_load');
}
開發者ID:tholu,項目名稱:Mercator,代碼行數:31,代碼來源:mercator.php

示例3: __construct

 /**
  * Constructor.
  *
  * @param string $key_prefix
  * @param string $group
  */
 public function __construct($key_prefix = '', $group = '')
 {
     $this->key_prefix = $key_prefix;
     $this->group = $group;
     if (function_exists('wp_cache_add_global_groups')) {
         wp_cache_add_global_groups([$group]);
     }
 }
開發者ID:frozzare,項目名稱:digster,代碼行數:14,代碼來源:class-wordpress-cache-adapter.php

示例4: __construct

 /**
  * Constructor. Allows you to set a key prefix and
  * the Object Cache group to use.
  *
  * Setting a custom prefix or group isn't required, see:
  * https://github.com/bobthecow/mustache.php/issues/246
  *
  * @param string $key_prefix
  * @param string $group
  */
 public function __construct($key_prefix = '', $group = 'mustache-cache')
 {
     $this->key_prefix = $key_prefix;
     $this->group = $group;
     //Add to global cache group so that we do not cache the same templates multiple times on multisite
     if (function_exists('wp_cache_add_global_groups')) {
         wp_cache_add_global_groups(array($group));
     }
 }
開發者ID:khromov,項目名稱:mustache-wordpress-cache,代碼行數:19,代碼來源:Mustache_Cache_WordPressCache.php

示例5: add_global_groups

 /**
  * Add global cache groups.
  *
  * @uses	wp_cache_add_global_groups
  *
  * @param 	array 			$args				Function arguments.
  * @param 	array 			$assoc_args			Function arguments with parameter key.
  * @return	void
  */
 public function add_global_groups($args, $assoc_args)
 {
     if (empty($args)) {
         WP_CLI::line('usage: wp cache add_global_groups <group>');
         exit;
     }
     $group = $args[0];
     wp_cache_add_global_groups($group);
 }
開發者ID:rpeterson,項目名稱:wp-cli,代碼行數:18,代碼來源:cache.php

示例6: __construct

 /**
  * Constructor.
  */
 function __construct()
 {
     /**
     		/* Memcached Object Cache v2.0.2 doesn't like when we loop on switch_to_blog()
     		/* We "fix" this by storing our cached items in global group 'pb'
     */
     wp_cache_add_global_groups(array('pb'));
     $this->registerThemeDirectories();
     do_action('pressbooks_loaded');
 }
開發者ID:jflowers45,項目名稱:pressbooks,代碼行數:13,代碼來源:class-pb-pressbooks.php

示例7: configure_groups

 function configure_groups()
 {
     // Configure the memcached client
     if (!$this->remote) {
         if (function_exists('wp_cache_add_no_remote_groups')) {
             wp_cache_add_no_remote_groups(array($this->group));
         }
     }
     if (function_exists('wp_cache_add_global_groups')) {
         wp_cache_add_global_groups(array($this->group));
     }
 }
開發者ID:nb,項目名稱:batcache,代碼行數:12,代碼來源:advanced-cache.php

示例8: 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

示例9: 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', 'usermail', 'usernicename'));
 }
開發者ID:rmccue,項目名稱:glotpress-plugin,代碼行數:13,代碼來源:testcase.php

示例10: startup

/**
 * Attach Mercator into WordPress
 *
 * Imagine this as attaching the strings to the puppet.
 */
function startup()
{
    // Define the table variables
    if (empty($GLOBALS['wpdb']->dmtable)) {
        $GLOBALS['wpdb']->dmtable = $GLOBALS['wpdb']->base_prefix . 'domain_mapping';
        $GLOBALS['wpdb']->ms_global_tables[] = 'domain_mapping';
    }
    // Ensure cache is shared
    wp_cache_add_global_groups(array('domain_mapping'));
    // Actually hook in!
    add_filter('pre_get_site_by_path', __NAMESPACE__ . '\\check_domain_mapping', 10, 2);
    add_action('admin_init', __NAMESPACE__ . '\\load_admin', -100);
}
開發者ID:Tarendai,項目名稱:Mercator,代碼行數:18,代碼來源:mercator.php

示例11: init

 /**
  * WordPress action to set up data-related WordPress hooks.
  *
  * @since 1.4
  * @usedby do_action() init
  */
 public static function init()
 {
     global $geo_mashup_options;
     // Some caching plugins don't implement this
     if (function_exists('wp_cache_add_global_groups')) {
         wp_cache_add_global_groups(array('geo_mashup_object_locations', 'geo_mashup_locations'));
     }
     // Avoid orphans
     add_action('delete_post', array('GeoMashupDB', 'delete_post'));
     add_action('delete_comment', array('GeoMashupDB', 'delete_comment'));
     add_action('delete_user', array('GeoMashupDB', 'delete_user'));
     if ('true' == $geo_mashup_options->get('overall', 'copy_geodata')) {
         self::add_geodata_sync_hooks();
     }
 }
開發者ID:hack4reno2011,項目名稱:BetaReno,代碼行數:21,代碼來源:geo-mashup-db.php

示例12: init

 /**
  * WordPress action to set up data-related WordPress hooks.
  *
  * @since 1.4
  */
 public static function init()
 {
     global $geo_mashup_options;
     // Enable the geo_mashup_query var
     add_filter('query_vars', array('GeoMashupDB', 'query_vars'));
     add_filter('posts_fields', array('GeoMashupDB', 'posts_fields'), 10, 2);
     add_filter('posts_join', array('GeoMashupDB', 'posts_join'), 10, 2);
     add_filter('posts_where', array('GeoMashupDB', 'posts_where'), 10, 2);
     add_action('parse_query', array('GeoMashupDB', 'parse_query'));
     // Some caching plugins don't implement this
     if (function_exists('wp_cache_add_global_groups')) {
         wp_cache_add_global_groups(array('geo_mashup_object_locations', 'geo_mashup_locations'));
     }
     // Avoid orphans
     add_action('delete_post', array('GeoMashupDB', 'delete_post'));
     add_action('delete_comment', array('GeoMashupDB', 'delete_comment'));
     add_action('delete_user', array('GeoMashupDB', 'delete_user'));
     if ('true' == $geo_mashup_options->get('overall', 'copy_geodata') or '' != $geo_mashup_options->get('overall', 'import_custom_field')) {
         self::add_geodata_sync_hooks();
     }
 }
開發者ID:pioneerskies,項目名稱:geobeni,代碼行數:26,代碼來源:geo-mashup-db.php

示例13: ga_init

/**
 * Initializes the plugin.
 *
 * Loads the required files, registers the new DB table, global cache groups and global capabilities.
 *
 * @since 1.0.0
 */
function ga_init()
{
    if (!function_exists('wp_network_roles')) {
        add_action('admin_notices', 'ga_requirements_notice_network_roles');
        add_action('network_admin_notices', 'ga_requirements_notice_network_roles');
        return;
    }
    define('GA_PATH', plugin_dir_path(__FILE__));
    define('GA_URL', plugin_dir_url(__FILE__));
    require_once GA_PATH . 'global-admin/wp-includes/load.php';
    require_once GA_PATH . 'global-admin/wp-includes/option.php';
    require_once GA_PATH . 'global-admin/wp-includes/class-wp-global-role.php';
    require_once GA_PATH . 'global-admin/wp-includes/class-wp-global-roles.php';
    require_once GA_PATH . 'global-admin/wp-includes/capabilities.php';
    require_once GA_PATH . 'global-admin/wp-includes/class-wp-user-with-network-and-global-roles.php';
    require_once GA_PATH . 'global-admin/wp-includes/user.php';
    require_once GA_PATH . 'global-admin/wp-includes/link-template.php';
    require_once GA_PATH . 'global-admin/wp-includes/admin-bar.php';
    require_once GA_PATH . 'global-admin/wp-includes/ms-functions.php';
    require_once GA_PATH . 'global-admin/wp-includes/ms-default-filters.php';
    require_once GA_PATH . 'global-admin/wp-admin/includes/schema.php';
    require_once GA_PATH . 'global-admin/wp-admin/includes/hacks.php';
    require_once ABSPATH . 'wp-admin/includes/plugin.php';
    if (is_plugin_active('wp-multi-network/wpmn-loader.php')) {
        require_once GA_PATH . 'global-admin/multi-network-compat.php';
    }
    if (is_plugin_active('wp-user-signups/wp-user-signups.php')) {
        require_once GA_PATH . 'global-admin/user-signups-compat.php';
    }
    if (is_multinetwork()) {
        ga_register_table();
        add_action('setup_theme', 'ga_setup_wp_global_roles', 1);
    }
    if (function_exists('wp_cache_add_global_groups')) {
        wp_cache_add_global_groups(array('global-options', 'global-transient'));
    }
}
開發者ID:felixarntz,項目名稱:global-admin,代碼行數:44,代碼來源:global-admin.php

示例14: 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

示例15: 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


注:本文中的wp_cache_add_global_groups函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。