-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
in function can #19824
base: master
Are you sure you want to change the base?
in function can #19824
Conversation
/* @var string $json to cache the $params too */ $allowCaching && $json = json_encode($params); if ($allowCaching && isset($this->_access[$permissionName][$json])) { return $this->_access[$permissionName][$json]; } ... if ($allowCaching) { $this->_access[$permissionName][$json] = $access; }
PR Summary
|
Hm, why were parameters not cached in the first place? 🤔 Anyway, md5 might be a better solution because of the json locale converting, encoding problems, etc. |
i thinked it but when i am debuging i would like see the parameters values. Other way is use print_r. parameters not cached in the first place may be this var chache use ram and it can have memory limitation; then it will can use app cache |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am against this change in the current form.
If you have some kind of check with can
with different params for every call this will blow up your cache.
then it can with send parameter false to $allowCaching |
but you need to update existing code, it would be OK if you could enable that with a global option like @bizley @samdark Actually we're in code-freeze state ... related discussion: #19831 |
Memory usage is not that bad if we use The bigger problem is that we don't know what is passed as |
We could rely on the developer with $allowCaching 🙄 ... (yeah, right) or add check for any errors in json_encode... |
My concern was, if someone has ie. |
I would not expect that someone will call this method 100k times in a single request. |
Ah sorry, I thought it would be written into the app cache. |
/* @var string $json to cache the $params too */
$allowCaching && $json = json_encode($params);
if ($allowCaching && isset($this->_access[$permissionName][$json])) {
return $this->_access[$permissionName][$json];
}
...
if ($allowCaching) {
$this->_access[$permissionName][$json] = $access;
}