private PersistentStringEnumerator(@NotNull final File file, final int initialSize, boolean cacheLastMappings, @Nullable PagedFileStorage.StorageLockContext lockContext) throws IOException { super(file, new EnumeratorStringDescriptor(), initialSize, lockContext); if (cacheLastMappings) { myIdToStringCache = new SLRUMap[STRIPE_COUNT]; myHashcodeToIdCache = new SLRUMap[STRIPE_COUNT]; myStripeLocks = new Lock[STRIPE_COUNT]; int protectedSize = 8192; int probationalSize = 8192; for(int i = 0; i < STRIPE_COUNT; ++i) { myHashcodeToIdCache[i] = new SLRUMap<Integer, Integer>(protectedSize / STRIPE_COUNT, probationalSize / STRIPE_COUNT); myIdToStringCache[i] = new SLRUMap<Integer, String>(protectedSize / STRIPE_COUNT, probationalSize / STRIPE_COUNT); myStripeLocks[i] = new SequenceLock(); } } else { myIdToStringCache = null; myHashcodeToIdCache = null; myStripeLocks = null; } }
public Task(VirtualFile root, Hash hash, SLRUMap<Hash, List<String>> cache, @Nullable PermanentGraph<Integer> graph, @Nullable VcsLogRefs refs) { this.root = root; this.hash = hash; this.cache = cache; this.graph = graph; this.refs = refs; }
public CachingEnumerator(DataEnumerator<Data> base, KeyDescriptor<Data> dataDescriptor) { myBase = base; myDataDescriptor = dataDescriptor; int protectedSize = 8192; int probationalSize = 8192; for(int i = 0; i < STRIPE_COUNT; ++i) { myHashcodeToIdCache[i] = new SLRUMap<Integer, Integer>(protectedSize / STRIPE_COUNT, probationalSize / STRIPE_COUNT); myIdToStringCache[i] = new SLRUMap<Integer, Data>(protectedSize / STRIPE_COUNT, probationalSize / STRIPE_COUNT); myStripeLocks[i] = new SequenceLock(); } }
public ContentRevisionCache() { myLock = new Object(); myCache = new SLRUMap<Key, SoftReference<byte[]>>(100, 50); myCurrentRevisionsCache = new SLRUMap<CurrentKey, VcsRevisionNumber>(200, 50); myCustom = new SLRUMap<Pair<FilePath, VcsRevisionNumber>, Object>(30,30); myCounter = 0; }
public ShortDiffDetails(Project project, Getter<Change[]> master, final VcsChangeDetailsManager vcsChangeDetailsManager) { myMaster = master; myProject = project; myVcsChangeDetailsManager = vcsChangeDetailsManager; myDetailsCache = new SLRUMap<FilePath, RefreshablePanel>(10, 10) { @Override protected void onDropFromCache(FilePath key, RefreshablePanel value) { if (value != null) { Disposer.dispose(value); } } }; }
public CachedPersistentHashMap(File file, KeyDescriptor<Key> keyDescriptor, DataExternalizer<Value> valDescriptor, final int cacheSize) throws IOException { super(file, keyDescriptor, valDescriptor); myCache = new SLRUMap<Key,Value>(cacheSize * 2, cacheSize) { protected void onDropFromCache(Key key, Value value) { if (isValueDirty(value)) { try { CachedPersistentHashMap.super.put(key, value); } catch (IOException e) { LOG.info(e); } } } }; }
public DetailsCache(final Project project, final UIRefresh uiRefresh, final DetailsLoaderImpl detailsLoader, final BackgroundTaskQueue queue) { myProject = project; myDetailsLoader = detailsLoader; myQueue = queue; myStash = new HashMap<VirtualFile, Map<AbstractHash,String>>(); myRefresh = uiRefresh; myLock = new Object(); myCache = new SLRUMap<Pair<VirtualFile, AbstractHash>, GitHeavyCommit>(ourSize, 150); myBranches = new SLRUMap<Pair<VirtualFile, AbstractHash>, List<String>>(20, 20); }
public GitCommitsSequentialIndex() { myLock = new Object(); final File vcsFile = new File(PathManager.getSystemPath(), "vcs"); myDir = new File(vcsFile, "git_line"); myDir.mkdirs(); // will contain list of roots mapped to myListFile = new File(myDir, "repository_index"); myCache = new SLRUMap<Pair<Long, VirtualFile>, List<Pair<AbstractHash, Long>>>(10,10); myPacks = new SLRUMap<VirtualFile, List<Long>>(10,10); }
public Task(VirtualFile root, Hash hash, SLRUMap<CommitId, List<String>> cache, @Nullable PermanentGraph<Integer> graph, @Nullable RefsModel refs) { this.root = root; this.hash = hash; this.cache = cache; this.graph = graph; this.refs = refs; }
public CachingEnumerator(DataEnumerator<Data> base, KeyDescriptor<Data> dataDescriptor) { myBase = base; myDataDescriptor = dataDescriptor; int protectedSize = 8192; int probationalSize = 8192; for(int i = 0; i < STRIPE_COUNT; ++i) { myHashcodeToIdCache[i] = new SLRUMap<Integer, Integer>(protectedSize / STRIPE_COUNT, probationalSize / STRIPE_COUNT); myIdToStringCache[i] = new SLRUMap<Integer, Data>(protectedSize / STRIPE_COUNT, probationalSize / STRIPE_COUNT); myStripeLocks[i] = new ReentrantLock(); } }
public FileAccessorCache(int protectedQueueSize, int probationalQueueSize) { myCache = new SLRUMap<K, Handle<T>>(protectedQueueSize, probationalQueueSize, this) { @Override protected final void onDropFromCache(K key, Handle<T> value) { value.release(); } }; }
public ContentRevisionCache() { myLock = new Object(); myCache = new SLRUMap<>(100, 50); myCurrentRevisionsCache = new SLRUMap<>(200, 50); myCustom = new SLRUMap<>(30, 30); myCounter = 0; }
public SoftHardCacheMap(final int protectedQueueSize, final int probationalQueueSize) { mySLRUMap = new SLRUMap<K, V>(protectedQueueSize, probationalQueueSize); mySoftLinkMap = new SoftValueHashMap<K, V>(); }
@NotNull private static SLRUMap<Hash, List<String>> createCache() { return new SLRUMap<Hash, List<String>>(1000, 1000); }
private RareLogger(final Logger logger, final boolean fairSynch) { myLogger = logger; final Object lock = new Object(); myCache = new SLRUMap<Object, Long>(64, 32) { @Override public Long get(Object key) { if (fairSynch) { synchronized (lock) { return super.get(key); } } return super.get(key); } @Override public void put(Object key, @NotNull Long value) { if (fairSynch) { synchronized (lock) { super.put(key, value); return; } } super.put(key, value); } @Override public boolean remove(Object key) { if (fairSynch) { synchronized (lock) { return super.remove(key); } } return super.remove(key); } }; myConvertors = new LinkedList<LogFilter>(); // just passes to parent logger myProxy = new LogFilter() { @Override @NotNull public Integer getAllowedLoggingInterval(Level level, String message, Throwable t, String[] details) { return -1; } @Override public Object getKey(@NotNull Level level, @NonNls String message, @Nullable Throwable t, @NonNls String... details) { if (Level.DEBUG.equals(level)) { logger.debug(message, t); } else if (Level.INFO.equals(level)) { logger.info(message, t); } else if (Level.WARN.equals(level)) { logger.warn(message, t); } else if (Level.ERROR.equals(level)) { logger.error(message, t, details); } return null; } }; }
public ContentAnnotationCacheImpl() { myLock = new Object(); myCache = new SLRUMap<HistoryCacheWithRevisionKey, TreeMap<Integer, Long>>(50, 50); }
public VcsHistoryCache() { myLock = new Object(); myHistoryCache = new SLRUMap<HistoryCacheBaseKey, CachedHistory>(10, 10); myAnnotationCache = new SLRUMap<HistoryCacheWithRevisionKey, VcsAnnotation>(10, 5); //myContentCache = new SLRUMap<HistoryCacheWithRevisionKey, String>(20, 20); }
public FragmentedDiffRequestFromChange(Project project) { myProject = project; myRangesCache = new SLRUMap<Pair<Long, String>, List<BeforeAfter<TextRange>>>(10, 10); }
public LinesCache() { myCache = new SLRUMap<String, GitHeavyCommit>(ourSize, 50); }
@Nonnull private static SLRUMap<CommitId, List<String>> createCache() { return new SLRUMap<>(1000, 1000); }
private RareLogger(final Logger logger, final boolean fairSynch) { myLogger = logger; final Object lock = new Object(); myCache = new SLRUMap<Object, Long>(64, 32) { @Override public Long get(Object key) { if (fairSynch) { synchronized (lock) { return super.get(key); } } return super.get(key); } @Override public void put(Object key, @Nonnull Long value) { if (fairSynch) { synchronized (lock) { super.put(key, value); return; } } super.put(key, value); } @Override public boolean remove(Object key) { if (fairSynch) { synchronized (lock) { return super.remove(key); } } return super.remove(key); } }; myConvertors = new LinkedList<LogFilter>(); // just passes to parent logger myProxy = new LogFilter() { @Override @Nonnull public Integer getAllowedLoggingInterval(Level level, String message, Throwable t, String[] details) { return -1; } @Override public Object getKey(@Nonnull Level level, @NonNls String message, @Nullable Throwable t, @NonNls String... details) { if (Level.DEBUG.equals(level)) { logger.debug(message, t); } else if (Level.INFO.equals(level)) { logger.info(message, t); } else if (Level.WARN.equals(level)) { logger.warn(message, t); } else if (Level.ERROR.equals(level)) { logger.error(message, t, details); } return null; } }; }