Add cached statistics for a Local Site's ACLs.
Review Request #12304 — Created May 27, 2022 and submitted
This introduces a new manager stats method,
LocalSiteManager.get_local_site_acl_stats(). This returns a dictionary
- The number of users on the Local Site
- The number of admins on the Local Site
- Whether the Local Site is public
- A UUID representing the generated state (which can be used as a
component of other cache keys to enable automatic invalidation)
This is per-Local Site. It exists on the manager so that either a
LocalSiteinstance can be provided, or the primary key of
LocalSite. That makes it usable in methods where we may not yet want
to fetch a
This information is cached. It's invalidated whenever user/admin
membership changes, when
publicdoes or may have changed (based on
LocalSite.save()is called with/without
This will soon be used by other query-generating code to conditionally
fetch data from the database, and as components for other cache keys.
Unit tests pass.