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
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-fetchedLocalSiteinstance 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, whenpublicdoes or may have changed (based on
whetherLocalSite.save()is called with/withoutupdate_fields=), or
when aLocalSiteis 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.
| Summary | ID |
|---|---|
| 9e7b28fc4deec04c4c781f172ba94206c8cce7c4 |