class PermissionCache
Caches the permission lists of group-ID sets.
The permissions a user has are fully determined by the set of group IDs they belong to, so users sharing a group set can share one `group_permission` load. Without this, any code that checks an ability against each serialized user — extension serializer flags, policies, visibility scopers — issues one identical query per user instance. The cache is a container singleton, so its entries last one request under PHP-FPM; a queue worker flushes it as each job starts. Changes made by another process never reach it, so other long-running processes must flush it themselves. Within a process, entries are invalidated when permissions change: per affected group for model writes, and wholesale for the admin permission endpoint (which writes through the query builder and bypasses model events). Code that modifies the `group_permission` table directly should call `flush()`.
Properties
| protected array<string, string[]> | $permissions | Permission lists keyed by sorted group-ID set. |
|
Methods
Forget every cached set that contains the given group, e.g. because the group's permissions changed or the group was deleted.
Details
at
line 43
array|null
get(array $groupIds)
at
line 52
void
put(array $groupIds, array $permissions)
at
line 61
void
forgetGroup(int $groupId)
Forget every cached set that contains the given group, e.g. because the group's permissions changed or the group was deleted.