Java Code Examples for org.apache.shiro.cache.ehcache.EhCacheManager#setCacheManager()
The following examples show how to use
org.apache.shiro.cache.ehcache.EhCacheManager#setCacheManager() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ShiroConfig.java From supplierShop with MIT License | 6 votes |
/** * 缓存管理器 使用Ehcache实现 */ @Bean public EhCacheManager getEhCacheManager() { net.sf.ehcache.CacheManager cacheManager = net.sf.ehcache.CacheManager.getCacheManager("ruoyi"); EhCacheManager em = new EhCacheManager(); if (StringUtils.isNull(cacheManager)) { em.setCacheManager(new net.sf.ehcache.CacheManager(getCacheManagerConfigFileInputStream())); return em; } else { em.setCacheManager(cacheManager); return em; } }
Example 2
Source File: ShiroConfig.java From ruoyiplus with MIT License | 6 votes |
/** * 缓存管理器 使用Ehcache实现 */ @Bean public EhCacheManager getEhCacheManager() { net.sf.ehcache.CacheManager cacheManager = net.sf.ehcache.CacheManager.getCacheManager("ruoyi"); EhCacheManager em = new EhCacheManager(); if (StringUtils.isNull(cacheManager)) { em.setCacheManagerConfigFile("classpath:ehcache/ehcache-shiro.xml"); return em; } else { em.setCacheManager(cacheManager); return em; } }
Example 3
Source File: ShiroConfig.java From LuckyFrameWeb with GNU Affero General Public License v3.0 | 6 votes |
/** * 缓存管理器 使用Ehcache实现 */ @Bean public EhCacheManager getEhCacheManager() { net.sf.ehcache.CacheManager cacheManager = net.sf.ehcache.CacheManager.getCacheManager("luckyframe"); EhCacheManager em = new EhCacheManager(); if (StringUtils.isNull(cacheManager)) { em.setCacheManager(new net.sf.ehcache.CacheManager(getCacheManagerConfigFileInputStream())); return em; } else { em.setCacheManager(cacheManager); return em; } }
Example 4
Source File: CacheManagerBuilder.java From jsets-shiro-spring-boot-starter with Apache License 2.0 | 6 votes |
private CacheManager decision(org.springframework.cache.CacheManager springCacheManager) { if (springCacheManager instanceof EhCacheCacheManager) { EhCacheManager ehCacheManager = new EhCacheManager(); ehCacheManager.setCacheManager(((EhCacheCacheManager) springCacheManager).getCacheManager()); return ehCacheManager; } if (springCacheManager instanceof org.springframework.data.redis.cache.RedisCacheManager) { GenericJackson2JsonRedisSerializer jsonSerializer = new GenericJackson2JsonRedisSerializer(); RedisTemplate rt = new RedisTemplate<Object, Object>(); rt.setConnectionFactory(SpringContextUtils.getBean(RedisConnectionFactory.class)); rt.setKeySerializer(jsonSerializer); rt.setHashKeySerializer(jsonSerializer); rt.setBeanClassLoader(this.getClass().getClassLoader()); rt.afterPropertiesSet(); RedisCacheManager redisCacheManager = new RedisCacheManager(); redisCacheManager.setRedisTemplate(rt); return redisCacheManager; } return new SpringCacheManager(springCacheManager); }
Example 5
Source File: ShiroConfig.java From jsets-shiro-spring-boot-starter with Apache License 2.0 | 6 votes |
private void biuldCacheManager() { this.cacheManager = this.customizer.getCacheManager(); if(Objects.isNull(this.cacheManager)) { if(Objects.isNull(springCacheManager)) { this.cacheManager = new MapCacheManager(); }else { if (springCacheManager instanceof EhCacheCacheManager) { EhCacheManager ehCacheManager = new EhCacheManager(); ehCacheManager.setCacheManager(((EhCacheCacheManager) springCacheManager).getCacheManager()); this.cacheManager = ehCacheManager; } if (springCacheManager instanceof org.springframework.data.redis.cache.RedisCacheManager) { RedisCacheManager redisCacheManager = new RedisCacheManager(); redisCacheManager.setRedisTemplate(RedisUtils.imitateRedisTemplate()); this.cacheManager = redisCacheManager; } } } this.cacheDelegator = new CacheDelegator(this.cacheManager); }
Example 6
Source File: ShiroConfig.java From MeetingFilm with Apache License 2.0 | 5 votes |
/** * 缓存管理器 使用Ehcache实现 */ @Bean public CacheManager getCacheShiroManager(EhCacheManagerFactoryBean ehcache) { EhCacheManager ehCacheManager = new EhCacheManager(); ehCacheManager.setCacheManager(ehcache.getObject()); return ehCacheManager; }
Example 7
Source File: AuthConfig.java From v-mock with MIT License | 5 votes |
/** * 缓存管理器 */ @Bean public EhCacheManager getEhCacheManager() { net.sf.ehcache.CacheManager cacheManager = net.sf.ehcache.CacheManager.getCacheManager("vmock"); EhCacheManager em = new EhCacheManager(); em.setCacheManager(cacheManager == null ? new net.sf.ehcache.CacheManager(getCacheManagerConfigFileInputStream()) : cacheManager); return em; }
Example 8
Source File: ShiroConfig.java From WebStack-Guns with MIT License | 5 votes |
/** * 缓存管理器 使用Ehcache实现 */ @Bean public CacheManager getCacheShiroManager(EhCacheManagerFactoryBean ehcache) { EhCacheManager ehCacheManager = new EhCacheManager(); ehCacheManager.setCacheManager(ehcache.getObject()); return ehCacheManager; }
Example 9
Source File: ShiroConfig.java From springboot-learn with MIT License | 5 votes |
/** * 缓存管理器 使用Ehcache实现 */ @Bean public EhCacheManager getEhCacheManager() { CacheManager cacheManager = CacheManager.getCacheManager("shiro"); EhCacheManager em = new EhCacheManager(); if (StringUtils.isEmpty(cacheManager)) { em.setCacheManagerConfigFile("classpath:ehcache/ehcache-shiro.xml"); return em; } else { em.setCacheManager(cacheManager); return em; } }
Example 10
Source File: ShiroConfig.java From RuoYi with Apache License 2.0 | 5 votes |
/** * 缓存管理器 使用Ehcache实现 */ @Bean public EhCacheManager getEhCacheManager() { net.sf.ehcache.CacheManager cacheManager = net.sf.ehcache.CacheManager.getCacheManager("ruoyi"); EhCacheManager em = new EhCacheManager(); if (ObjectUtil.isNull(cacheManager)) { em.setCacheManager(new net.sf.ehcache.CacheManager(getCacheManagerConfigFileInputStream())); return em; } else { em.setCacheManager(cacheManager); return em; } }
Example 11
Source File: ShiroConfiguration.java From mblog with GNU General Public License v3.0 | 4 votes |
@Bean public CacheManager shiroCacheManager(net.sf.ehcache.CacheManager cacheManager) { EhCacheManager ehCacheManager = new EhCacheManager(); ehCacheManager.setCacheManager(cacheManager); return ehCacheManager; }