<commit_before>package ch.bind.philib.cache.lru;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

import ch.bind.philib.validation.Validation;

public final class SyncCache<K, V> implements Cache<K, V> {

	private final Lock lock = new ReentrantLock();

	private final Cache<K, V> cache;

	public SyncCache(Cache<K, V> cache) {
		Validation.notNull(cache);
		this.cache = cache;
	}

	@Override
	public void add(K key, V value) {
		lock.lock();
		try {
			cache.add(key, value);
		} finally {
			lock.unlock();
		}
	}

	@Override
	public V get(K key) {
		lock.lock();
		try {
			return cache.get(key);
		} finally {
			lock.unlock();
		}
	}
<commit_msg>utility method for easier access<commit_after>package ch.bind.philib.cache.lru;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

import ch.bind.philib.validation.Validation;

public final class SyncCache<K, V> implements Cache<K, V> {

	private final Lock lock = new ReentrantLock();

	private final Cache<K, V> cache;

	public SyncCache(Cache<K, V> cache) {
		Validation.notNull(cache);
		this.cache = cache;
	}

	public static final <K, V> Cache<K, V> wrap(Cache<K, V> cache) {
		return new SyncCache<K, V>(cache);
	}

	@Override
	public void add(K key, V value) {
		lock.lock();
		try {
			cache.add(key, value);
		} finally {
			lock.unlock();
		}
	}

	@Override
	public V get(K key) {
		lock.lock();
		try {
			return cache.get(key);
		} finally {
			lock.unlock();
		}
	}

{'fraction_non_alphanumeric': 0.13936591809775428, 'fraction_numerical': 0.0, 'mean_word_length': 3.675925925925926, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, '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': '4622654', 'n_tokens_mistral': 602, 'n_tokens_neox': 549, 'n_words': 134}