Welcome Guest, Not a member yet? Register   Sign In
What is the difference between APC caching and Memcached caching?
#1

[eluser]Unknown[/eluser]
What is the difference between APC caching and Memcached caching in the new Cache Class in CodeIgniter 2.0?

Thanks!
#2

[eluser]jedd[/eluser]
Hi laur3ntlapo and welcome to the CI forums.

APC is an opcode cache - that is it caches your PHP, so that on the next run the code doesn't need to be fully parsed. There are settings (in php.ini / apc.ini) to control how this works - I haven't used it extensively, but I recall you can control whether the APC module relies on datestamps for the .php file (if newer, then re-parse) and you can force it to never check the .php (good for production sites where you're happy to restart apache when uploading new code.

Memcache is a data cache - a kind of key-value store that people often use as a cache for slower databases (MySQL, postgres, NOSQL variants, etc).
#3

[eluser]Unknown[/eluser]
Thank you jedd! Perfect answer Smile
#4

[eluser]n0xie[/eluser]
While I agree with jedd, APC is more than just an opcode cache. It too has a key=>value store, although much simpler. But it might be just 'good enough' for most not so high performance sites.
#5

[eluser]jedd[/eluser]
Hi n0xie - you're absolutely right, and I don't know how I missed that - thanks for picking me up on it.

I had checked the php.net page on apc just to be sure, and even there it says that apc is an opcode cache, which is all we've ever used it for. Actually, the devs I work with use apc for opcode, and memcache(d) for a key->value store in front of both MySQL and Cassandra. Heck, we've even played with redis as a slightly more persistent (though slightly hungrier, perhaps even slightly wobblier Smile key->value store.
#6

[eluser]n0xie[/eluser]
I personally wouldn't recommend using APC for key->value store (we use both Redis and Memcached) since it has a lot of buggy behaviour and is not distributed, but it might be enough for a simple caching mechanism. Just wanted to point it out to make your statement, 'more' correct ;-)
#7

[eluser]mr_prasanna[/eluser]
Also, APC type of caching is good for smaller lists which doesn't change too frequently.




Theme © iAndrew 2016 - Forum software by © MyBB