<commit_before>package se.su.it.svc.manager

import net.sf.ehcache.CacheManager
import net.sf.ehcache.Ehcache
import net.sf.ehcache.Cache
import net.sf.ehcache.config.CacheConfiguration
import net.sf.ehcache.Element
import org.apache.log4j.Logger
import net.sf.ehcache.config.Searchable
import net.sf.ehcache.config.SearchAttribute;
/**
 * Created by: <NAME> (jaen4109)
 * Date: 2012-08-30 ~ 11:22
 *
 */
class EhCacheManager {

  private static final Logger logger = Logger.getLogger(EhCacheManager.class)
  def final Object NULL = "NULL"
  def final int DEFAULT_TTL = (60 * 10)
  private props = Properties.getInstance().props


  def final static EhCacheManager INSTANCE = new EhCacheManager()
  final CacheManager cacheManager
  def final String DEFAULT_CACHE_NAME = 'cache'

  private EhCacheManager(){
    cacheManager = CacheManager.getInstance()
  }

  public static getInstance(){
    return INSTANCE
  }


  public Ehcache getCache(String cacheName = DEFAULT_CACHE_NAME) {
    if(!cacheName){
      cacheName = DEFAULT_CACHE_NAME
    }

    def cacheInstance = cacheManager.getCache(cacheName)

    if(!cacheInstance) {
      //cacheInstance = cacheManager.addCacheIfAbsent(cacheName)

      //CacheConfiguration config = cacheInstance.getCacheConfiguration()
      CacheConfiguration config = new CacheConfiguration(cacheName, 0)
      config.setTimeToIdleSeconds(props.ehcache.timetoidleseconds as Long)
      config.setTimeToLiveSeconds(props.ehcache.timetoliveseconds as Long)
      config.setMaxEntriesLocalHeap(props.ehcache.maxentrieslocalheap as Long)
      config.setMaxElementsOnDisk(props.ehcache.maxelementsondisk as int)
      config.setOverflowToDisk(props.ehcache.overflowtodisk as Boolean)


      Searchable searchable = new Searchable(keys: false, values: false)
      //searchable.addSearchAttribute(new SearchAttribute().name("class").expression('value.getClass().getName()'))<commit_msg>removed unwanted comment<commit_after>package se.su.it.svc.manager

import net.sf.ehcache.CacheManager
import net.sf.ehcache.Ehcache
import net.sf.ehcache.Cache
import net.sf.ehcache.config.CacheConfiguration
import net.sf.ehcache.Element
import org.apache.log4j.Logger
import net.sf.ehcache.config.Searchable
import net.sf.ehcache.config.SearchAttribute;
/**
 * Created by: <NAME> (jaen4109)
 * Date: 2012-08-30 ~ 11:22
 *
 */
class EhCacheManager {

  private static final Logger logger = Logger.getLogger(EhCacheManager.class)
  def final Object NULL = "NULL"
  def final int DEFAULT_TTL = (60 * 10)
  private props = Properties.getInstance().props


  def final static EhCacheManager INSTANCE = new EhCacheManager()
  final CacheManager cacheManager
  def final String DEFAULT_CACHE_NAME = 'cache'

  private EhCacheManager(){
    cacheManager = CacheManager.getInstance()
  }

  public static getInstance(){
    return INSTANCE
  }


  public Ehcache getCache(String cacheName = DEFAULT_CACHE_NAME) {
    if(!cacheName){
      cacheName = DEFAULT_CACHE_NAME
    }

    def cacheInstance = cacheManager.getCache(cacheName)

    if(!cacheInstance) {
      //cacheInstance = cacheManager.addCacheIfAbsent(cacheName)

      //CacheConfiguration config = cacheInstance.getCacheConfiguration()
      CacheConfiguration config = new CacheConfiguration(cacheName, 0)
      config.setTimeToIdleSeconds(props.ehcache.timetoidleseconds as Long)
      config.setTimeToLiveSeconds(props.ehcache.timetoliveseconds as Long)
      config.setMaxEntriesLocalHeap(props.ehcache.maxentrieslocalheap as Long)
      config.setMaxElementsOnDisk(props.ehcache.maxelementsondisk as int)
      config.setOverflowToDisk(props.ehcache.overflowtodisk as Boolean)


      Searchable searchable = new Searchable(keys: false, values: false)
{'fraction_non_alphanumeric': 0.08871616188689359, 'fraction_numerical': 0.011793084963816671, 'mean_word_length': 4.537091988130563, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5323034', 'n_tokens_mistral': 1147, 'n_tokens_neox': 1081, 'n_words': 233}