@Override
	protected boolean onCache(ByteBuffer buffer) 
	{
		int size = buffer.capacity();

		if (!buffer.isDirect() || size < minSize || size > maxSize) {
			return false;
		}
		
		ByteBufferStack stack = map.get(size);
		if (stack == null) {
			// Only acquire write lock when adding to map.
			synchronized (writeLock) {
				stack = new ByteBufferStack();
				map.put(size, stack);
			}
		}
		stack.push(buffer);
		return true;
	}