Resource icon

Cache Permission Checks 1.1.6

No permission to buy ($35.00)
Compatible XF 2.x versions
  1. 2.1
  2. 2.2
Additional requirements
php 7.0+
Standard Library by Xon
Redis Cache by Xon
Redis (v3.0.0 or better)
phpredis (for performance)
Updates duration
12 Months ($25 Yearly Renewal + GST for Australian Residents)
Visible branding
Reduce data fetched from MySQL and queries by bulk-fetching pre-computed sets from a Redis cache

XenForo permission-sets are stored per row per content-type, and there are a number of cases where this can result in a large number of rows being fetched or N+1 queries.

This add-on extracts the permission sets and caches the resulting set for by permission_combination_id/content_type.
This includes the special "global" permission set (as permission_combination_id/#user)

Support the cache context permComboIds

Criteria for use of this add-on
Use of this add-on is only recommended if all the following criteria are met;
  1. A multiple server setup, where the database is separate from multiple front-end webserver
  2. Large numbers of user-groups/node combinations.
It is strongly preferred that Redis is configured to have a read-only slave on each front-end webserver

  • Requires php 7.0+
  • Requires XenForo 2.1+
  • Requires Redis Cache due to active selective cache invalidation

Cache invalidation
  • Editing permissions for user-group/user/moderators
  • Add-on installed/upgraded/uninstalled
  • Any automated process which touches;
    • \XF\Service\UpdatePermissions::triggerCacheRebuild()
    • \XF\Entity\User::rebuildPermissionCombination()
    • \XF\Permission\Builder::rebuildCombination()
config.php options

// limit number of permission-sets for different permission combination ids to help control memory usage
$config['permissionCache']['cache_limit'] = 3;
// time in seconds to cache entries for
$config['permissionCache']['cache_time'] = 7 * 86400;
// Prune 'false' entires, as this can be accurately represented with an absence
$config['permissionCache']['sparse'] = true;
Related resources
First release
Last update
0.00 star(s) 0 ratings

More resources from Xon