Memcached-in PHP, is it faster to put data in the cache or to include data through include?

Source: Internet
Author: User
I am a newbie and I am not very clear about the specific php Execution Mode. Some basic configuration parameters of the website are saved in the database and use memcache memory better? Or is the configuration stored in the PHP file in the form of file read/write, and can be directly used through include? Which efficiency is more... I am a newbie and I am not very clear about the specific execution mode of php.
Some basic configuration parameters of the website are saved in the database and use memcache memory better? Or is the configuration stored in the PHP file in the form of file read/write, and can be directly used through include?
Which one is more efficient?
I feel like the latter, because you don't need to link memcache cache to read data, you can directly use variables. I am not sure, but I am a bit ambiguous. I hope the experts can tell me which one is better, who is more efficient, and how PHP uses the memory.
Thank you !!

Reply content:

I am a newbie and I am not very clear about the specific php Execution Mode.
Some basic configuration parameters of the website are saved in the database and use memcache memory better? Or is the configuration stored in the PHP file in the form of file read/write, and can be directly used through include?
Which one is more efficient?
I feel like the latter, because you don't need to link memcache cache to read data, you can directly use variables. I am not sure, but I am a bit ambiguous. I hope the experts can tell me which one is better, who is more efficient, and how PHP uses the memory.
Thank you !!

If you have installed the cache opcode extensions such as apc, it must be saved to php quickly; otherwise, it is faster memory.

It's faster to put it in the PHP file, provided that you are talking about the configuration file.

The simplest and quickest way is to do a comparative test.

It depends on whether you are a memory-level cache or a file-level cache. If you use redis, memcache, and so on, it must be faster than include. Also, it depends on the size of your include file, there are many factors to influence. If it's just a simple small program, it's okay to use include.

Save it to the php array and save it to the database. The temporary database table is adjusted to the memory mode.

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.