<commit_before>
package edu.wustl.catissuecore.util;

import java.io.Serializable;

import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheException;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Element;
import edu.wustl.catissuecore.util.global.Constants;

/**
 * <p>Title: CatissueCoreCacheManager Class</p>
 * <p>Description:Singleton factory class handling caching operations.</p>
 * Copyright:    Copyright (c) year
 * Company: Washington University, School of Medicine, St. Louis.
 * @author <NAME>
 * @version 1.00
 * Created on Sep 26, 2006
 */

public class CatissueCoreCacheManager
{

	/**
	 * Singleton reference to the CatissueCoreCacheManager
	 */
	private static CatissueCoreCacheManager catissueCoreCacheManager;

	/**
	 *  reference to CacheManager
	 */
	private static CacheManager manager;

	/**
	 *  reference to Cache
	 */
	private static Cache cache;

	/**
	 * Protected constructor of the singleton class
	 * @throws CacheException
	 */
	protected CatissueCoreCacheManager() throws CacheException
	{
		// create singleton instance of CacheManager
		CacheManager.create();
		// get instance of cachemanager
		manager = CacheManager.getInstance();
		// get cache for CatissueCore which is configured in ehcache.xml
		cache = manager.getCache(Constants.EHCACHE_FOR_CATISSUE_CORE);
	}

	/**
	 * Method returning the singleton instance of the
	 * CatissueCoreCacheManager
	 *
	 * @return CatissueCoreCacheManager
	 * @throws CacheException
	 */
	public static synchronized CatissueCoreCacheManager getInstance() throws CacheException
	{
		if (catissueCoreCacheManager == null)
		{
			catissueCoreCacheManager = new CatissueCoreCacheManager();
		}
		return catissueCoreCacheManager;
	}

	/**
	 * Method used to add Serializable object to cache
	 * @param key - Serializable key
	 * @param value - Serializable value
	 */
	public void addObjectToCache(Serializable key, Serializable value)
	{
		// creating elemtnt from key,value
		Element element = new Element(key, value);
		// Adding element to cache
		cache.put(element);
	}

	/**<commit_msg>added method removeObjectFromCache<commit_after>
package edu.wustl.catissuecore.util;

import java.io.Serializable;

import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheException;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Element;
import edu.wustl.catissuecore.util.global.Constants;

/**
 * <p>Title: CatissueCoreCacheManager Class</p>
 * <p>Description:Singleton factory class handling caching operations.</p>
 * Copyright:    Copyright (c) year
 * Company: Washington University, School of Medicine, St. Louis.
 * @author <NAME>
 * @version 1.00
 * Created on Sep 26, 2006
 */

public class CatissueCoreCacheManager
{

	/**
	 * Singleton reference to the CatissueCoreCacheManager
	 */
	private static CatissueCoreCacheManager catissueCoreCacheManager;

	/**
	 *  reference to CacheManager
	 */
	private static CacheManager manager;

	/**
	 *  reference to Cache
	 */
	private static Cache cache;

	/**
	 * Protected constructor of the singleton class
	 * @throws CacheException
	 */
	protected CatissueCoreCacheManager() throws CacheException
	{
		// create singleton instance of CacheManager
		CacheManager.create();
		// get instance of cachemanager
		manager = CacheManager.getInstance();
		// get cache for CatissueCore which is configured in ehcache.xml
		cache = manager.getCache(Constants.EHCACHE_FOR_CATISSUE_CORE);
	}

	/**
	 * Method returning the singleton instance of the
	 * CatissueCoreCacheManager
	 *
	 * @return CatissueCoreCacheManager
	 * @throws CacheException
	 */
	public static synchronized CatissueCoreCacheManager getInstance() throws CacheException
	{
		if (catissueCoreCacheManager == null)
		{
			catissueCoreCacheManager = new CatissueCoreCacheManager();
		}
		return catissueCoreCacheManager;
	}

	/**
	 * Method used to add Serializable object to cache
	 * @param key - Serializable key
	 * @param value - Serializable value
	 */
	public void addObjectToCache(Serializable key, Serializable value)
	{
		// creating elemtnt from key,value
		Element element = new Element(key, value);
		// Adding element to cache
		cache.put(element);
	}
	
	/**
	 * Method used to remove Serializable object to cache
	 * @param key - Serializable key
	 */
	public void removeObjectFromCache(Serializable key)
	{
		// Adding element to cache
		cache.remove(key);
	}


	/**
{'fraction_non_alphanumeric': 0.09014148790506618, 'fraction_numerical': 0.004107713372889092, 'mean_word_length': 4.162544169611308, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '7250631', 'n_tokens_mistral': 1342, 'n_tokens_neox': 1218, 'n_words': 361}