Use the -M switch and memcached will return an error when the memory is exhausted rather than deleting items.
Example:
memcached -d -m 1000 -M
This starts memcached, demonized with a maximum memory of 1000 MB. It will return an error when 1000 MB is consumed.
source
share