• Hi! First off, thanks for the continued work on the plugin. Great to see so many improvements landing over time.

    I want to report a subtle improvement that I believe will help many users.

    In the current version of the plugin, you have the ability to enable “Cache Logged-in Users” for different user roles, which is fantastic. However, looking through the execute-cache.php file code, lines 125–136 append the logged-in username to the $filename. So in short, what the plugin is doing is actually creating a unique cache file for each individual page for every individual user. Which technically is great on low-traffic sites. However, with say a decent size site consisting of 100 pages and 4000 users in that user role, this would end up generating up to 400,000 individual cache files. Let’s assume an average of 100KB per file, you’re talking about generating close to 40GB of data!

    In certain cases, like ours, the site may be optimized to where data on cacheable pages does not include personal information and pages can be cached on a per-role basis rather than a per-user basis. This means that the cache can be greatly improved and optimized by only storing a single copy of those pages for each necessary role. So with the above example, enabling it for that one user role would only generate up to 100 files. So not even 1MB of data. A gigantic savings. ??

    Of course, it should come with a gentle reminder that the same cached content would get served to all the users of that role, but for those that could benefit from it, like us, this could be an extremely helpful improvement.

    The great news is that implementation-wise, you pretty much have all the necessary code already there. You already extract the logged-in user’s roles earlier in the code with breeze_which_role_folder( $value ), so it’s a matter of tapping into that data and grabbing say the first available role.

    if ( ! empty( $folder_cache ) ) {
        $role_name = $folder_cache[ 0 ];
    }

    Then just using that as part of the file name instead of $nameuser.

    All you would have left is to add a simple toggle to the admin page that just enables caching pages for logged-in users on a per-user-role basis this way and you’re all set! ??

    In a dream scenario, the plugin would allow us to specify which URLs can be excluded from being cached this way (similar to how the general exclusions are handled).

    Thoughts?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Allow Cache Logged-in User Roles’ is closed to new replies.