gpt4 book ai didi

php - Symfony 2 安全 : keeps reloading data from user provider?

转载 作者:可可西里 更新时间:2023-10-31 22:49:41 24 4
gpt4 key购买 nike

当用户已经登录时,安全组件会在每次请求时不断从用户提供程序重新加载数据。有没有办法避免这种情况?当您的用户提供者不在本地数据库中时,例如,在网络服务中,这会大大降低系统速度。

每次请求我都会得到这个:

[2012-08-15 20:07:30] security.DEBUG: Read SecurityContext from the session [] []
[2012-08-15 20:07:30] security.DEBUG: Reloading user from user provider. [] []

最佳答案

您可以根据您的需要决定是否为每个请求刷新您的用户,方法是覆盖您从给定安全性依赖的 UserProviderInterface 实现的 refreshUser 方法上下文。

请引用以下API文档:

UserProviderInterface.html#method_refreshUser

It is up to the implementation to decide if the user data should be totally reloaded (e.g. from the database), or if the UserInterface object can just be merged into some internal array of users / identity map.

关于php - Symfony 2 安全 : keeps reloading data from user provider?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11976569/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com