In CountLimited, the synchronized protects four fields, _mapKeyPos, _keys, _values, _status. So the synchronized should be necessary. We can't replace the Map with ConcurrentHashMap. In this patch, I make some small improvement to the code.
In patch-C3156-20110724-2.txt, I use ReentrantReadWriteLock to improve the cache.
At review of CountLimited I asked myself if it wouldn't be neccessary to get a write lock at get() as it modifies status?
Yes, you are right. I have missed the get(). Sorry for that. I just submitted a new patch for that.
Patch committed as is