0

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?

Ben
  • 3,630
  • 17
  • 62
  • 93

1 Answers1

2

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.

Andrew M.
  • 10,982
  • 2
  • 34
  • 29