<commit_before>/*
 * Copyright (C) <NAME> <https://github.com/tmbo>
 */
package com.scalableminds.util.cache

class LRUConcurrentCache[K, V](maxEntries: Int) {
  private val cache = new java.util.LinkedHashMap[K, V]() {
    override def removeEldestEntry(eldest: java.util.Map.Entry[K, V]): Boolean = size > maxEntries
  }

  def put(key: K, value: V) {
    cache.synchronized {
      cache.put(key, value)
    }
  }

  def get(key: K): Option[V] = {
    cache.synchronized {
      Option(cache.get(key))
    }
  }

  def clear(): Unit = {
    cache.clear()
  }
}<commit_msg>added new relic stats to cache<commit_after>/*
 * Copyright (C) <NAME> <https://github.com/tmbo>
 */
package com.scalableminds.util.cache

class LRUConcurrentCache[K, V](maxEntries: Int) {
  private val cache = new java.util.LinkedHashMap[K, V]() {
    override def removeEldestEntry(eldest: java.util.Map.Entry[K, V]): Boolean = size > maxEntries
  }

  def put(key: K, value: V) {
    cache.synchronized {
      cache.put(key, value)
    }
  }

  def get(key: K): Option[V] = {
    cache.synchronized {
      Option(cache.get(key))
    }
  }

  def size(): Int = {
    cache.size()
  }

  def clear(): Unit = {
    cache.clear()
  }
}
{'fraction_non_alphanumeric': 0.1593724194880264, 'fraction_numerical': 0.0, 'mean_word_length': 3.0, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2770197', 'n_tokens_mistral': 459, 'n_tokens_neox': 447, 'n_words': 95}