Add cached statistics for a Local Site's ACLs.
Review Request #12304 — Created May 27, 2022 and submitted — Latest diff uploaded
This introduces a new manager stats method,
LocalSiteManager.get_local_site_acl_stats()
. This returns a dictionary
containing:
- 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
pre-fetchedLocalSite
instance can be provided, or the primary key of
aLocalSite
. That makes it usable in methods where we may not yet want
to fetch aLocalSite
.This information is cached. It's invalidated whenever user/admin
membership changes, whenpublic
does or may have changed (based on
whetherLocalSite.save()
is called with/withoutupdate_fields=
), or
when aLocalSite
is deleted.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.