optimized caching using ReentrantReadWriteLock