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

org.loom.appengine.scope.MemcacheFlashContext Maven / Gradle / Ivy

The newest version!
package org.loom.appengine.scope;

import org.loom.servlet.names.SessionAttributeNames;
import org.loom.servlet.scope.FlashContext;

import com.google.appengine.api.memcache.Expiration;
import com.google.appengine.api.memcache.MemcacheService;

public class MemcacheFlashContext extends FlashContext {

	private transient MemcacheService memcache;
	
	private transient int expirationSeconds;
	
    private static final long serialVersionUID = -2229794470754667710L;

	public MemcacheFlashContext(MemcacheService memcache, String id, int expirationSeconds) {
		super(id);
		this.memcache = memcache;
		this.expirationSeconds = expirationSeconds;
	}
	
	/**
	 * Store this context object into memcache. This method should be invoked 
	 * at the end of processinfg the current request.
	 */
	public void store() {
		memcache.put(SessionAttributeNames.FLASH_PREFIX + getId(), this, Expiration.byDeltaSeconds(expirationSeconds));
	}
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy