List of usage examples for org.apache.shiro.cache MapCache MapCache
public MapCache(String name, Map<K, V> backingMap)
From source file:com.infinities.skyport.distributed.impl.hazelcast.shiro.cache.HazelcastCacheManager.java
License:Apache License
/** * Returns a {@link MapCache} instance representing the named * Hazelcast-managed {@link com.hazelcast.core.IMap IMap}. The Hazelcast Map * is obtained by calling {@link HazelcastInstance#getMap(String) * hazelcastInstance.getMap(name)}.//from www . j av a 2 s . co m * * @param name * the name of the cache to acquire. * @param <K> * the type of map key * @param <V> * the type of map value * @return a {@link MapCache} instance representing the named * Hazelcast-managed {@link com.hazelcast.core.IMap IMap}. * @throws CacheException * @see HazelcastInstance#getMap(String) * @see #ensureHazelcastInstance() * */ @Override public <K, V> Cache<K, V> getCache(String name) throws CacheException { Map<K, V> map = ensureHazelcastInstance().getMap(name); // returned map // is a // ConcurrentMap return new MapCache<K, V>(name, map); }
From source file:com.stormpath.samples.shiro.hazelcast.cache.HazelcastCacheManager.java
License:Apache License
public <K, V> Cache<K, V> getCache(String name) throws CacheException { ConcurrentMap<K, V> map = ensureHazelcastInstance().getMap(name); return new MapCache<K, V>(name, map); }
From source file:com.yea.shiro.session.mgt.redis.ShiroSessionDAO.java
License:Apache License
public ShiroSessionDAO() { super.setCacheManager(new AbstractCacheManager() { @Override//from w ww.j a v a 2 s . c o m protected Cache<Serializable, Session> createCache(String name) throws CacheException { return new MapCache<Serializable, Session>(name, new ConcurrentHashMap<Serializable, Session>()); } }); this.setSessionIdGenerator(new ShiroSessionIdGenerator()); }