001package org.avaje.ebeanorm.hazelcast;
002
003import com.avaje.ebean.BackgroundExecutor;
004import com.avaje.ebean.cache.ServerCacheFactory;
005import com.avaje.ebean.cache.ServerCachePlugin;
006import com.avaje.ebean.config.ServerConfig;
007
008/**
009 * Creates the Hazelcast ServerCacheFactory implementation.
010 */
011public class HzCachePlugin implements ServerCachePlugin {
012
013  /**
014   * Create and return the Hazelcast ServerCacheFactory implementation.
015   * <p>
016   * This is called before the EbeanServer instance is created. The factory
017   * is used to create the ServerCache instances while the EbeanServer instance is
018   * being defined.
019   * </p>
020   *
021   * @param config   The configuration used when constructing the EbeanServer instance.
022   * @param executor The background executor service that can be used if needed.
023   * @return The server cache factory used to create the L2 caches.
024   */
025  @Override
026  public ServerCacheFactory create(ServerConfig config, BackgroundExecutor executor) {
027    return new HzCacheFactory(config, executor);
028  }
029}