• Resolved timbr

    (@brugman)


    Hi. I’ve got a site using another caching plugin which is overkill, we want none of their features, so we thought we’d switch to CE. I only have to move over their 25 cache excluded URLs.

    Your exclusion list features are a list of IDs, or a regex URL field. I can do both, but:

    1. If I use the ID list, I enter for example 21,22,26,50,52,33. The next time I want to remove a page from that list I will have to look up the ID. For me that’s annoying. For my client that’s very hard.

    2. If I use the regex URL field, how would you I enter 25 URL’s in there while keeping it readable/maintainable? It’s a textfield so that line will get very long.

    3. As the developer for the client I could manage the exclusions with a PHP hook, without an interface. Not ideal, but an option. Is there such a hook? I couldn’t find it in the docs or source code.

    How do you suggest managing a large number of exclusions?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Anonymous User 16850768

    (@anonymized-16850768)

    Extending the Cache Exclusions handling and improving input design is on my to do list as I agree that it currently has some limitations. Furthermore, creating a regular expression is not something beginner users would know how to do.

    In my experience I’ve typically maintained regular expressions elsewhere, like a testing tool, and then copied it to where it needs to go.

    The cache_enabler_bypass_cache hook would work great for this, for example:

    add_filter( 'cache_enabler_bypass_cache', 'cache_enabler_exclude_page_paths' );
    
    function cache_enabler_exclude_page_paths() {
    
        $page_path = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
    
        $excluded_page_paths = array(
            '/path/to/excluded/page/',
            '/path/to/excluded/page-2/',
        );
    
        if ( in_array( $page_path, $excluded_page_paths ) ) {
            return true;
        }
    
        return false;
    }
    Thread Starter timbr

    (@brugman)

    Thanks @coreyk. Looking forward to what you can do with the UI.

    I couldn’t decide how to solve this in the meantime so I coded every single solution I came up with: https://github.com/Brugman/managing-cache-enabler-exclusions

    • This reply was modified 4 years, 1 month ago by timbr.
    Thread Starter timbr

    (@brugman)

    Resolved.

    Anonymous User 16850768

    (@anonymized-16850768)

    That looks like a great solution! Thanks for sharing, @brugman.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How do I manage lots of exclusions’ is closed to new replies.