The writing is easy to understand, but is there any reason why you're just not using memcache's add method? For the price of a network call, you'll automatically get the LRU cache logic and a more deterministic behavior.
For which operation are you suggesting to use add() method? As far as I can see (and I just walked in so I might be overlooking something) you want to set data (overwrite) if it exist.
Add() will fail if key already exist (which should be the case under full load) and you will end up using set() anyways.
For which operation are you suggesting to use add() method? As far as I can see (and I just walked in so I might be overlooking something) you want to set data (overwrite) if it exist.
Add() will fail if key already exist (which should be the case under full load) and you will end up using set() anyways.