Home > Article > Backend Development > Are there any problems with using session to save some global data?
As the title states, these data are shared data (such as site information, etc.). A friend asked me before if I wanted to pass variables across controllers in YII. I told him about configuration files and using redis and memcache, but he couldn't say it well. Finally, I said throw it to the session, and was despised. . What do you think?
<code>ps:一个刚出道的php请教。</code>
As the title states, these data are shared data (such as site information, etc.). A friend asked me before if I wanted to pass variables across controllers in YII. I told him about configuration files and using redis and memcache, but he couldn't say it well. Finally, I said throw it to the session, and was despised. . What do you think?
<code>ps:一个刚出道的php请教。</code>
If the information is shared by all users, it can be placed in the cache, but it must also have persistent storage. For unchanged data, it can be placed in the configuration file;
If it is the data of a single user session, then there is no problem in putting it in the session. I I wonder what clever tricks your friend has up his sleeve
It’s okay to save some global data, as long as it’s not too big. If it is only temporarily stored, then delete it after use.