private void cacheCommit(final int commitId, long taskNumber) { // fill the cache with temporary "Loading" values to avoid producing queries for each commit // that has not been cached yet, // even if it will be loaded within a previous query if (!myCache.isKeyCached(commitId)) { myCache.put(commitId, (T) new IndexedDetails(myIndex, myHashMap, commitId, taskNumber)); } }
public void saveInCache(@NotNull TIntObjectHashMap<T> details) { UIUtil.invokeAndWaitIfNeeded( (Runnable) () -> details.forEachEntry( (key, value) -> { myCache.put(key, value); return true; })); }