mirror of
https://github.com/yiisoft/yii2.git
synced 2026-03-20 06:08:08 +01:00
* Cache user assignments to avoid unnecessary DB queries alternative to #9138 and #10981, only cache on `checkAccess` call which is usually called on every request. Cache is not necessary in RBAC management. Similar to #14061 but includes proper cache invalidation and test. `getAssignments()` always queries the DB. The cache is only applied on `checkAccess` calls, and invalidated as soon as the RBAC structure is modified through the manager component (verified by the test case). Regarding [concerns of memory usage](https://github.com/yiisoft/yii2/pull/14061#issuecomment-297982502) if used in batch mode on multiple users, you can call `invalidateCache()` method if this really causes a problem. fixes #7743 close #9138 close #14061 close #10981 See also - https://github.com/yiisoft/yii2/issues/7626#issuecomment-77745166 - https://github.com/yiisoft/yii2/pull/14061#issuecomment-319645488 * improve test naming * fix tests * fix assignment cache for non-scalar user-ids
487 B
487 B