test_class.file: oak-store-composite/src/test/java/org/apache/jackrabbit/oak/composite/StringCacheTest.java
test_class.identifier: StringCacheTest
test_case.body: @Test
      public void testCache() {
          StringCache cache = new StringCache();
  
          StringBuilder b = new StringBuilder("abc").append("xyz");
  
          String s1 = b.toString();
          String s2 = b.toString();
          String s3 = b.toString();
  
          Assert.assertNotSame(s1, s2);
          Assert.assertNotSame(s2, s3);
          Assert.assertNotSame(s1, s3);
  
          String c1 = cache.get(s1);
          String c2 = cache.get(s2);
          String c3 = cache.get(s3);
  
          Assert.assertSame(c1, c2);
          Assert.assertSame(c2, c3);
          Assert.assertSame(c1, c3);
      }
test_case.class_method_signature: StringCacheTest.testCache()
test_case.full_signature: @Test public void testCache()
test_case.identifier: testCache
test_case.invocations: append toString toString toString assertNotSame assertNotSame assertNotSame get get get assertSame assertSame assertSame
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCache()
focal_class.declarator: CACHE_SIZE = 1000
focal_class.modifier: private static final
focal_class.original_string: private static final int CACHE_SIZE = 1000;
focal_class.type: int
focal_class.var_name: CACHE_SIZE
focal_class.declarator: LOG = LoggerFactory.getLogger(StringCache.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(StringCache.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: cache = new ConcurrentHashMap<>(CACHE_SIZE)
focal_class.modifier: private final
focal_class.original_string: private final ConcurrentMap<String, String> cache = new ConcurrentHashMap<>(CACHE_SIZE);
focal_class.type: ConcurrentMap<String, String>
focal_class.var_name: cache
focal_class.declarator: monitor
focal_class.modifier: private
focal_class.original_string: private CompositeNodeStoreMonitor monitor;
focal_class.type: CompositeNodeStoreMonitor
focal_class.var_name: monitor
focal_class.file: oak-store-composite/src/main/java/org/apache/jackrabbit/oak/composite/StringCache.java
focal_class.identifier: StringCache
focal_class.class_method_signature: StringCache.get(String path)
focal_class.full_signature: public String get(String path)
focal_class.identifier: get
focal_class.modifiers: public
focal_class.parameters: (String path)
focal_class.return: String
focal_class.signature: String get(String path)
focal_class.class_method_signature: StringCache.withMonitor(CompositeNodeStoreMonitor monitor)
focal_class.full_signature: public StringCache withMonitor(CompositeNodeStoreMonitor monitor)
focal_class.identifier: withMonitor
focal_class.modifiers: public
focal_class.parameters: (CompositeNodeStoreMonitor monitor)
focal_class.return: StringCache
focal_class.signature: StringCache withMonitor(CompositeNodeStoreMonitor monitor)
focal_method.body: public String get(String path) {
          if (cache.size() >= CACHE_SIZE && !cache.containsKey(path)) {
              LOG.debug("Cache size too big. Revise your mount setup.");
              return path;
          }
          return cache.computeIfAbsent(path, (k) -> {
              if (monitor != null) {
                  monitor.onAddStringCacheEntry();
              }
              return path;
          });
      }
focal_method.class_method_signature: StringCache.get(String path)
focal_method.full_signature: public String get(String path)
focal_method.identifier: get
focal_method.invocations: size containsKey debug computeIfAbsent onAddStringCacheEntry
focal_method.modifiers: public
focal_method.parameters: (String path)
focal_method.return: String
focal_method.signature: String get(String path)