Code example for Cache

Methods: getIfPresent

0
    @Override 
    public String getChanges(@Nonnull Revision from,
                             @Nonnull Revision to,
                             @Nonnull String path) {
        PathRev key = diffCacheKey(path, from, to);
        StringValue diff = diffCache.getIfPresent(key);
        return diff != null ? diff.toString() : null;
    } 
 
    @Nonnull 
    @Override 
    public Entry newEntry(@Nonnull Revision from,
                          @Nonnull Revision to) {
        return new MemoryEntry(from, to);
    } 
 
    public CacheStats getDiffCacheStats() {
        return diffCacheStats;
    }