3 Commits

Author SHA1 Message Date
161526cd41 HTTPS everywhere (#19503) 2022-08-03 12:32:18 +03:00
fb23b0d0ea Code style fixes 2017-11-01 02:43:02 +03:00
711498f93a Cache user assignments to avoid unnecessary DB queries (#14696)
* 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
2017-09-01 10:50:36 +02:00