Support » Plugin: Redis Object Cache » Transient and redis cache issue

  • Resolved Rookie

    (@alriksson)


    I have not modified any WP_REDIS_IGNORED_GROUPS is this the default configured ignored groups you see in my Diagnostics? Does it look normal? Transient is not in the ignored group but facing problems with https://wordpress.org/support/topic/verify-menu-cache-and-text-domain-translation-cache/#post-15198154

    Seems like many useful groups are ignored? Themes and plugins etc? Should they be ignored? site-transient is not the same group as transient, am I correct?

    Status: Not connected
    Client: PhpRedis (v5.3.4)
    Drop-in: Valid
    Disabled: No
    Ping: 
    Connection Exception: Connection refused (RedisException)
    Errors: [
        "Connection refused"
    ]
    PhpRedis: 5.3.4
    Predis: Not loaded
    Credis: Not loaded
    PHP Version: 7.4.26
    Plugin Version: 2.0.22
    Redis Version: Unknown
    Multisite: No
    Metrics: Disabled
    Metrics recorded: null
    Filesystem: Working
    Global Prefix: "wp_"
    Blog Prefix: "wp_"
    WP_REDIS_PREFIX: "dev.example.com"
    WP_CACHE_KEY_SALT: "dev.example.com"
    Global Groups: [
        "blog-details",
        "blog-id-cache",
        "blog-lookup",
        "global-posts",
        "networks",
        "rss",
        "sites",
        "site-details",
        "site-lookup",
        "site-options",
        "site-transient",
        "users",
        "useremail",
        "userlogins",
        "usermeta",
        "user_meta",
        "userslugs",
        "redis-cache"
    ]
    Ignored Groups: [
        "counts",
        "plugins",
        "themes",
        "blog-details",
        "blog-id-cache",
        "blog-lookup",
        "global-posts",
        "networks",
        "rss",
        "sites",
        "site-details",
        "site-lookup",
        "site-options",
        "site-transient",
        "users",
        "useremail",
        "userlogins",
        "usermeta",
        "user_meta",
        "userslugs",
        "redis-cache",
        "blog_meta"
    ]
    Unflushable Groups: []
    Drop-ins: [
        "advanced-cache.php v by ",
        "Redis Object Cache Drop-In v2.0.22 by Till Krüss"
    ]

    While the ignore groups in object-cache.php shows:

        /**
         * List of global groups.
         *
         * @var array
         */
        public $global_groups = [
            'blog-details',
            'blog-id-cache',
            'blog-lookup',
            'global-posts',
            'networks',
            'rss',
            'sites',
            'site-details',
            'site-lookup',
            'site-options',
            'site-transient',
            'users',
            'useremail',
            'userlogins',
            'usermeta',
            'user_meta',
            'userslugs',
        ];
    
        /**
         * List of groups that will not be flushed.
         *
         * @var array
         */
        public $unflushable_groups = [];
    
        /**
         * List of groups not saved to Redis.
         *
         * @var array
         */
        public $ignored_groups = [
            'counts',
            'plugins',
            'themes',
        ];
    • This topic was modified 3 weeks ago by Rookie.
Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Till Krüss

    (@tillkruess)

    The default groups are: 'counts', 'plugins', 'themes'

    If your diagnostics show many other groups, then some thing is adding them.

    Thread Starter Rookie

    (@alriksson)

    Hmm for what reasons would someone what these in to ignored groups? Where could they have added this nothing in the wp-config.php, using Cloudways anything you are aware about that they add from their end into the ignored groups? Or would it be coming from other plugins?

    Plugin Author Till Krüss

    (@tillkruess)

    I can’t answer any of that. You can search for add_non_persistent_groups() to see who’s adding the groups.

    Thread Starter Rookie

    (@alriksson)

    No easy way to search for a line of code in all the plugins files via SFTP or any suggestion to easier locate and debug?

    Plugin Author Till Krüss

    (@tillkruess)

    SSH + find + grep 🤷‍♂️

    Thread Starter Rookie

    (@alriksson)

    @tillkruess See here:

    $ grep -r -H "add_non_persistent_groups" *
    grep: conf/server_letsencrypt.key: Permission denied
    grep: conf/server_letsencrypt.crt: Permission denied
    grep: conf/fpm-pool.conf: Permission denied
    public_html/wp-content/plugins/wpml-string-translation/inc/package-translation/inc/wpml-package-factory.class.php:		wp_cache_add_non_persistent_groups( __CLASS__ );
    public_html/wp-content/plugins/wp-asset-clean-up-pro/classes/ObjectCache.php:	public static function wpacu_cache_add_non_persistent_groups( $groups ) {
    public_html/wp-content/plugins/sitepress-multilingual-cms/classes/cookie/class-wpml-cookie.php:		wp_cache_add_non_persistent_groups( __CLASS__ );
    public_html/wp-content/plugins/sitepress-multilingual-cms/classes/language-switcher/class-wpml-ls-languages-cache.php:		wp_cache_add_non_persistent_groups( $cache_group );
    public_html/wp-content/plugins/redis-cache/includes/object-cache.php:function wp_cache_add_non_persistent_groups( $groups ) {
    public_html/wp-content/plugins/redis-cache/includes/object-cache.php:    $wp_object_cache->add_non_persistent_groups( $groups );
    public_html/wp-content/plugins/redis-cache/includes/object-cache.php:    public function add_non_persistent_groups( $groups ) {
    public_html/wp-content/object-cache.php:function wp_cache_add_non_persistent_groups( $groups ) {
    public_html/wp-content/object-cache.php:    $wp_object_cache->add_non_persistent_groups( $groups );
    public_html/wp-content/object-cache.php:    public function add_non_persistent_groups( $groups ) {
    public_html/wp-includes/load.php:		wp_cache_add_non_persistent_groups( array( 'counts', 'plugins' ) );
    public_html/wp-includes/class-wp-theme.php:				wp_cache_add_non_persistent_groups( 'themes' );
    public_html/wp-includes/cache.php:function wp_cache_add_non_persistent_groups( $groups ) {
    public_html/wp-includes/ms-blogs.php:			wp_cache_add_non_persistent_groups( array( 'counts', 'plugins' ) );
    public_html/wp-includes/ms-blogs.php:			wp_cache_add_non_persistent_groups( array( 'counts', 'plugins' ) );
    grep: ssl/server.crt: Permission denied
    grep: ssl/server.key: Permission denied

    Can not find anything in these plugins and respective php files which is adding any other groups to ignore.

    • This reply was modified 2 weeks, 5 days ago by Rookie.
    Plugin Author Till Krüss

    (@tillkruess)

    If those files don’t help, I’d add logging to wp_cache_add_non_persistent_groups() to see who’s doing it.

    Thread Starter Rookie

    (@alriksson)

    How would I add logging to wp_cache_add_non_persistent_groups()

    Plugin Author Till Krüss

    (@tillkruess)

    This is outside the support scope for this plugin. I’d suggest hiring a developer to assist you.

    Thread Starter Rookie

    (@alriksson)

    I unloaded WPML string translation plugin and saw only default. Now I activated and seeing this, while all groups before was in ignored. Now it looks more correct, right? Below happened once deactivate and activate the wpml stirng translation plugin.

    Global Groups: [
        "blog-details",
        "blog-id-cache",
        "blog-lookup",
        "global-posts",
        "networks",
        "rss",
        "sites",
        "site-details",
        "site-lookup",
        "site-options",
        "site-transient",
        "users",
        "useremail",
        "userlogins",
        "usermeta",
        "user_meta",
        "userslugs",
        "redis-cache",
        "blog_meta"
    ]
    Ignored Groups: [
        "counts",
        "plugins",
        "themes",
        "WPML_ST_Package_Factory"
    ]
    Unflushable Groups: []
    Drop-ins: [
        "advanced-cache.php v by ",
        "Redis Object Cache Drop-In v2.0.22 by Till Krüss"
    ]
    <?php
    
    class WPML_ST_Package_Factory {
    
    	/** @var WPML_WP_Cache_Factory $cache_factory */
    	private $cache_factory;
    
    	public function __construct( WPML_WP_Cache_Factory $cache_factory = null ) {
    		$this->cache_factory = $cache_factory;
    		wp_cache_add_non_persistent_groups( __CLASS__ );
    	}
    
    	/**
    	 * @param \stdClass|\WPML_Package|array|int $package_data
    	 *
    	 * @return WPML_Package
    	 */
    	public function create( $package_data ) {
    		$cache_item = $this->get_cache_item( $package_data );
    
    		if ( ! $cache_item->exists() ) {
    			$cache_item->set( new WPML_Package( $package_data ) );
    		}
    
    		return $cache_item->get();
    	}
    
    	/**
    	 * @param array|WPML_Package $package_data
    	 *
    	 * @return WPML_WP_Cache_Item
    	 */
    	private function get_cache_item( $package_data ) {
    		if ( ! $this->cache_factory ) {
    			$this->cache_factory = new WPML_WP_Cache_Factory();
    		}
    
    		$package_key = md5( json_encode( $package_data ) );
    
    		return $this->cache_factory->create_cache_item( __CLASS__, $package_key );
    	}
    }
    Thread Starter Rookie

    (@alriksson)

    @tillkruess Checked production as well with the pro version didn’t deactivate wpml string translation or anything there. Might have been some glitch, but it looks all fine, only default + wpml_st_package_factory is ignored.

    Global Groups	analytics, users, userlogins, usermeta, user_meta, useremail, userslugs, site-transient, site-options, blog-lookup, blog-details, site-details, rss, global-posts, blog-id-cache, networks, sites, blog_meta
    
    Non-persistent Groups	counts, plugins, themes, WPML_ST_Package_Factory
    
    Non-prefetchable Groups	analytics, userlogins, wc_session_id
    • This reply was modified 1 week, 6 days ago by Rookie.
    Plugin Author Till Krüss

    (@tillkruess)

    That looks a lot better 👍

Viewing 12 replies - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.