使用php查找memcached大小

I am using PHP memcached for storing records. But it is not storing more than 2000 records in the cache.

I am interesting in finding:

  1. How many records can be stored in Memcached?
  2. How to calculate the size of Memcached and what is the max limit to store in the cache?

Memcached size is set by your host. You can generally have it increased, but it also usually costs to do so.

If you're developing on a local machine, according to memcached docs, you can set the limit with memcached -m [size].

I found a perl utility here that seems to dump out the exact information that you're looking for.

Maximum limit of the cache :

  • it depends on how much memory you indicated memcached can used -- this is done when starting memcached.
  • Note, though, that each item you store in cache cannot be more than 1 MB


Size of the data in cache, number of items in cache : there are PHP functions which can help with that ; depending on the extension you are using to connect to memcached, see :


Maximum number of items you can store in memcached :

  • I've never hit any limit on one server ; and I've not found any number in the FAQ
  • Anyway, if you hit any possible limit with the servers you are currently using, just add one additional daemon : memcached works as a cluster ;-)