class SpringCacheBuilder extends BaseCacheBuilder {

  public <K, V> Cache<K, V> build() {

    switch (this.type) {
      case OFFHEAP:
        return CacheBuilder.offHeapCache().cacheLoader(cacheLoader)
            .evictionListener(evictionListener)
            .indexHandler(indexHandler).concurrencyLevel(concurrencyLevel)
            .bufferCleanerPeriod(bufferCleanerPeriod).bufferCleanerThreshold(bufferCleanerThreshold)
            .evictionPeriod(evictionPeriod).serializer(serializer).storage(bufferStore).build();

      case VERSIONED_OFFHEAP:
        return CacheBuilder.versionedOffHeapCache().cacheLoader(cacheLoader)
            .evictionListener(evictionListener)
            .indexHandler(indexHandler).concurrencyLevel(concurrencyLevel)
            .bufferCleanerPeriod(bufferCleanerPeriod).bufferCleanerThreshold(bufferCleanerThreshold)
            .evictionPeriod(evictionPeriod).serializer(serializer).storage(bufferStore).build();

      case REDIS:
        return CacheBuilder.redisCache().cacheLoader(cacheLoader).evictionListener(evictionListener)
            .serializer(serializer).concurrencyLevel(concurrencyLevel).hostName(redisHost)
            .port(redisPort)
            .build();

      default:
        return CacheBuilder.heapCache().cacheLoader(cacheLoader).evictionListener(evictionListener)
            .indexHandler(indexHandler).build();
    }
  }

  public  SpringCacheBuilder();
  public  SpringCacheBuilder(String type);

}