Is there any problem when using session to save some global data?

Source: Internet
Author: User
For example, the data is shared data (such as site information ). A friend asked me if I wanted to transfer variables across controllers in YII. I told me about configuration files, redis, memcache, and so on. Finally, I threw it into the session and was despised .. May I ask... for example, the data is shared data (such as site information ). A friend asked me if I wanted to transfer variables across controllers in YII. I told me about configuration files, redis, memcache, and so on. Finally, I threw it into the session and was despised .. What do you think?

Ps: A new php expert.

Reply content:

For example, the data is shared data (such as site information ). A friend asked me if I wanted to transfer variables across controllers in YII. I told me about configuration files, redis, memcache, and so on. Finally, I threw it into the session and was despised .. What do you think?

Ps: A new php expert.

If all users share the information, they can store it in the cache, but they must also store it persistently. for unchanged data, they can store it in the configuration file;
If it is the data of a user's single session, it is okay to put the session. I don't know what tricks your friend has.

It is okay to save some global data, as long as it is not too large. If you just store it temporarily, you can delete it once it is used up.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.