Partitioned cache

As the core query cache is based on a ConcurrentHashMap that is shared between all the partitions, when intensively accessed it may lead to mutex contention between the computer cores, and drastically reduced performance. The idea of this tool is to reduce the contention by using a specific cache per partition and then avoid any concurrency check.

This cache never uses any mutex on creation or use, but will not be used outside the current thread. It has the exact same behavior as the core query cache, except the sharing of the content between threads.

Retrieving the Thread Local cache

IQueryCache partitionedCache =
PartitionedCache.fromContext(getActivePivot().getContext());

Advantages and drawbacks

QueryCache PartitionedCache
Core product
Value sharing across post-processor and partitions
Thread safe
Intensive access
Big data compliant
Computation cache usage
Value computed only once once per thread

The PartitionedCache can be used to replace the query cache in all the function calls and usages.

Some important values can be moved once from the PartitionnedCache to the QueryCache :

Object value = PartitionedCache.fromContext(getActivePivot().getContext()).get(debugKey);
if(value != null) {
    getQueryCache().put(debugKey, value);
}