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

com.google.sitebricks.binding.HttpSessionFlashCache Maven / Gradle / Ivy

package com.google.sitebricks.binding;

import com.google.common.collect.MapMaker;
import com.google.inject.servlet.SessionScoped;
import net.jcip.annotations.ThreadSafe;

import java.io.Serializable;
import java.util.concurrent.ConcurrentMap;

/**
 * Used to store binding (or forwarding) information between successive requests.
 * 
 * @author Dhanji R. Prasanna ([email protected])
 */
@ThreadSafe @SessionScoped
public class HttpSessionFlashCache implements FlashCache, Serializable {
  private final ConcurrentMap cache = new MapMaker().makeMap();

  @SuppressWarnings("unchecked")
  public  T get(String key) {
    return (T) cache.get(key);
  }

  @SuppressWarnings("unchecked")
  public  T remove(String key) {
    return (T) cache.remove(key);
  }

  public  void put(String key, T t) {
    cache.put(key, t);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy