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

org.appops.cache.impl.GuavaCacheImpl Maven / Gradle / Ivy

/*
 * AppOps is a Java framework to develop, deploy microservices with ease and is available for free
 * and common use developed by AinoSoft ( www.ainosoft.com )
 *
 * AppOps and AinoSoft are registered trademarks of Aino Softwares private limited, India.
 *
 * Copyright (C) <2016> 
 *
 * This program is free software: you can redistribute it and/or modify it under the terms of the
 * GNU General Public License as published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version along with applicable additional terms as
 * provisioned by GPL 3.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License and applicable additional terms
 * along with this program.
 *
 * If not, see  and 
 */

package org.appops.cache.impl;

import com.google.inject.Inject;
import java.util.HashMap;
import org.appops.cache.helper.GuavaCacheHelper;
import org.appops.cache.slim.Cache;

/**
 * Google guava cache based server side implementation of {@link org.appops.cache.slim.Cache}.
 *
 * @author suraj
 * @version $Id: $Id
 */
public class GuavaCacheImpl implements Cache {

  private GuavaCacheHelper helper;

  /**
   * {@inheritDoc}
   *
   * Associates given value with given key in the cache. If the cache previously contained a value
   * associated with given key, the old value is replaced by given value.
   */
  @Override
  public void put(String key, String value) {
    helper.put(key, value);
  }

  /**
   * {@inheritDoc}
   *
   * It copies all of the mappings from the specified map to the cache.
   */
  @Override
  public void putAll(HashMap map) {
    helper.putAll(map);
  }


  /**
   * {@inheritDoc}
   *
   * It returns the value associated with given key in this cache.
   */
  @Override
  public Object getIfPresent(String key) {
    return helper.getIfPresent(key);
  }

  /**
   * {@inheritDoc}
   *
   * Discards any cached value for key.
   */
  @Override
  public void invalidate(String key) {
    helper.invalidate(key);
  }

  /**
   * {@inheritDoc}
   *
   * It discards all values of given key from cache.
   */
  @Override
  public void invalidateAll(Iterable keys) {
    helper.invalidateAll(keys);

  }

  /**
   * {@inheritDoc}
   *
   * It discards all entries from cache.
   */
  @Override
  public void invalidateAll() {
    helper.invalidateAll();
  }

  /**
   * {@inheritDoc}
   *
   * Performs any pending maintenance operations needed by the cache. Exactly which activities are
   * performed -- if any -- is implementation-dependent.
   */
  @Override
  public void cleanUp() {
    helper.cleanUp();
  }



  /**
   * 

* Getter for the field helper. *

* * @return a {@link org.appops.cache.helper.GuavaCacheHelper} object. */ public GuavaCacheHelper getHelper() { return helper; } /** *

* Setter for the field helper. *

* * @param helper a {@link org.appops.cache.helper.GuavaCacheHelper} object. */ @Inject public void setHelper(GuavaCacheHelper helper) { this.helper = helper; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy