Reputation: 453
I'm searching google and it seems i cant find an exact answer.
I'm done installing the PHP Memcached, I can view it in phpinfo() and I was able to test the connection as per php.net manual.
My question is simple. Do I need to recode all my PHP files in order to take advantage of memcached or its a plug n play type? Is there a way to check if the PHP is actually using the memcached and not pooling same data/report from database?
Thanks in advance.
Upvotes: 0
Views: 135
Reputation: 24419
Memcached (installed from PECL) is a shared library. If it's enable, you should be able to starting using it within your application -- right away.
shell~> php -m | grep memcached
Yes. Memcached extends the memcache protocol/API to a PHP object. You'll have to determine what get's cached within your application. With objects, this is easily done be extending Memcached.
class MyCacheObject extends Memcached
You can telnet directly to the Memcached server, and see what's stored
shell ~> telnet localhost 11211
telnet~> stats items
That's up to you. Some people will use Memcache to store results from the database, PHP Objects, or indexes/queries to find additional data from the database. This boils down to what exactly you would like to cache. I prefer to store results from the database; such that, repetitive DB calls are reduced.
Upvotes: 1