I've never understood why we used Smarty and memcache~.

Source: Internet
Author: User
I've never understood why we used Smarty and memcache~~~~.
All say Smarty + memcache with is a good combination, but I do not understand why use the Smarty also use memcache~
Because Smarty does not have a page cache, for example, now there is a page a, I specify that it caches the time is 10 minutes, it is as long as every 10 minutes of logical operation can be. What's the use of memcache?

Can you give me a small example of how smarty and memcache work together?

Thank you, everyone!

Share to:


------Solution--------------------
Save the place is not the same, memcache is stored in memory, Smarty is stored on the hard disk, read data must be read from memory fast, you see HA these 2 principles of it
------Solution--------------------
Since smarty can cache it. Why do you use Memcache?
------Solution--------------------
This is simple: Smarty is only used by a handful of junior PHP programmers due to the different operating mechanisms and scope of application, while Memcache is widely adopted and derived from the memory-based database system
------Solution--------------------
One is for the data, a targeted access to the page, such as the longest way to put the query out of the bar data into memcache, and some of the page real-time refresh requirements are not high then the Smarty cache, the scope of action is different, like you eat carrots and eat watermelon almost, Eat carrots is to increase vitamin C, eat watermelon is to increase vitamin D, this if still confused, you can first don't have to tangle, wait for slowly to know
------Solution--------------------
Two different things ... Like Kyzy said. Although it is said to be a caching service, the specific objects and implementations of the cache are not quite the same. Although after a variety of SM can also be able to accommodate each other, but a little off trousers.

Simply say Smarty caches the final result. Memcache the middle part of the cache. Of course, this is more general, but how much you can know they are not to solve the same problem intersection.
------Solution--------------------
The Smarty cache is file-based and can be called Filecache
Accessing files must be slower than accessing memory
That's why Smarty + memcache
Which means you can modify the Smarty to put the cache in Memcache.

As for what, how to use, it is a program problem. independent of implementation Technology
  • 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.