In essence, the AbstractCachingInterceptor.invoke() works like this:
------------------------------------
Object cached = cache.getFromCache(key, model);
if (null == cached)
return cachedValueFromSource(mi, key, model);
return unmaskNull(cached);
------------------------------------
If two threads calls getFromCache() at the same time with the same key and the object is not in the cache yet, it's likely that both threads will proceed and put the results to the cache twice.
Is this a known issue in the cache module? Synchronize the invoke() method will avoid this issue but it will not scale at all so do not think it's a good idea.
Looks to me this is a very common issue, yet i do not see a good solution. Are people just ignoring this problem because 1) it will only happen under load. 2) Even if it happens, it's just inefficient, the cache is not corrupted.
thanks!


