Created
February 12, 2013 16:13
-
-
Save crised/4770990 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package web; | |
import org.infinispan.Cache; | |
import org.infinispan.manager.DefaultCacheManager; | |
import org.infinispan.manager.EmbeddedCacheManager; | |
import org.jboss.logging.Logger; | |
import javax.annotation.PostConstruct; | |
import javax.annotation.Resource; | |
import javax.enterprise.context.RequestScoped; | |
import javax.inject.Inject; | |
import javax.inject.Named; | |
import java.util.concurrent.TimeUnit; | |
@Named | |
@RequestScoped | |
public class Pagination { | |
@Resource(lookup = "java:jboss/infinispan/container/appcache") | |
private EmbeddedCacheManager cacheManager; | |
Cache cache; | |
static final Logger log = Logger.getLogger(Pagination.class); | |
int counter; | |
@PostConstruct | |
public void method() { | |
cache = cacheManager.getCache("pagination",false); | |
cache.put(0, "Hello"); | |
} | |
public void log(){ | |
if(cache.get(0)==null){ | |
cache.put(0, "Refreshed: " + counter + "times"); | |
counter++; | |
} | |
log.info(cache.get(0)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment