All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.setl.json.primitive.cache.SimpleLruCacheFactory Maven / Gradle / Ivy

Go to download

An implementation of the Canonical JSON format with support for javax.json and Jackson

The newest version!
package io.setl.json.primitive.cache;

/**
 * A factory that creates simple LRU caches.
 *
 * @author Simon Greatrix on 05/02/2020.
 */
public class SimpleLruCacheFactory implements ICacheFactory {

  /** New instance. */
  public SimpleLruCacheFactory() {
    // do nothing
  }


  @Override
  public  ICache create(CacheType type, int maxSize) {
    if (type == CacheType.STRINGS) {
      @SuppressWarnings("unchecked")
      ICache cache = (ICache) new StringLruCache(maxSize);
      return cache;
    }

    return new SimpleLruCache<>(maxSize);
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy