class AbstractCache implements IDataCache<T> {

  @Override
  public boolean setMaxCacheSize(long maxCacheSize) {
    if (maxCacheSize <= 0) {
      log.error("The provided cache size is negative. Must be positive.");
      throw new IllegalArgumentException("The provided cache size is negative. Must be positive.");
    }

    lock.writeLock().lock();
    try {
      this.maxCacheSize = maxCacheSize;
      // If the new cache size is smaller than the old one, we might need to evict
      // entries
      while (getFreeSpace() < 0) {
        removeEntryByCachingStrategy();
      }
    } finally {
      lock.writeLock().unlock();
    }
    return true;
  }

  public  AbstractCache(S entries, IDataStorage<T> cachedStorage, long maxCacheSize,
      Predicate<T> cachingRule);

}