Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I've never used memcache but am struggling to see the benefit when I use Smarty caching. The reason I ask is that it says it saves data so as to take load off of the database. Well, I don't run queries I don't need because my pages are cached with Smarty. Of course YouTube and other huge sites that are listed that utilize Memcache don't use Smarty, but am I missing something that it does or is it just not something I need to worry about using?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

If you're talking about templating, Smarty caching stores files on the disk, which means that it may not always have them active in memory. memcache, on the other hand, stores things in active memory--and is highly scalable. That is, I could add and remove hundreds of memcache clients, running locally, in the cloud, or both, on the fly. Its really an amazing architecture.

However, the beauty of memcached is that it allows you to store things at will--so while the Smarty templating engine may take the page and store the entire thing in memory, you can have memcached JUST store the things you want cached. I.e., a huge query that selects the latest posts, or something of the sort. Even more is, you can use a generic key that unrelated services can tweak. For example, everytime you add a new post, you could have memcached remove the key for that SQL query on the front page and rebuild it.

But if you're not seeing load issues, I wouldn't worry. memcached is great, but you don't have go full throttle on a site that doesn't have load concerns.

Andrew

EDIT: You may also want to check out kode, which stores the Smarty cached files in memcached.

share|improve this answer
1  
If you really need to add/remove memcached servers on the fly then please consider Membase which specializes in this area: www.membase.org –  Rob Olmos Nov 5 '10 at 21:58
    
Great tip, Rob. I was not aware of Membase! –  Andrew M. Nov 7 '10 at 16:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.