コード例 #1
0
 @Bean(name = "shiroCacheManager")
 public CacheManager cacheManager() {
   logger.debug("create cache mamager.");
   EhCacheManager cacheManager = new EhCacheManager();
   cacheManager.setCacheManager(CacheConfig.ehCacheManagerFactoryBean().getObject());
   return cacheManager;
 }
コード例 #2
0
  @Override
  public synchronized void start() throws Exception {
    checkState(!started, "Already started");

    log.info("Starting");

    // FIXME: Sort out overlap in responsibility between lifecycle here and RealmManagerImpl
    // FIXME: Wonder if a provider to handle configuration of RealmSecurityManager here is better?

    // prepare security manager
    if (realmSecurityManager instanceof Initializable) {
      ((Initializable) realmSecurityManager).init();
    }

    // prepare shiro cache
    EhCacheManager shiroCacheManager = new EhCacheManager();
    shiroCacheManager.setCacheManager(cacheManager);
    realmSecurityManager.setCacheManager(shiroCacheManager);

    // TODO: Sort out better means to invoke lifecycle here, realm-manager is only here for
    // start/stop now
    realmManager.start();

    started = true;
  }
コード例 #3
0
ファイル: ShiroConfig.java プロジェクト: paulfrom/jpa-shrio
 @Bean
 public EhCacheManager ehCacheManager() {
   net.sf.ehcache.config.Configuration managerConfiguration =
       new net.sf.ehcache.config.Configuration()
           .name("shiroCache")
           .updateCheck(false)
           .defaultCache(
               new CacheConfiguration()
                   .maxEntriesLocalHeap(10000)
                   .eternal(true)
                   .timeToIdleSeconds(120)
                   .timeToLiveSeconds(120)
                   .overflowToDisk(false)
                   .diskPersistent(false)
                   .diskExpiryThreadIntervalSeconds(120));
   net.sf.ehcache.CacheManager manager = net.sf.ehcache.CacheManager.create(managerConfiguration);
   EhCacheManager cacheManager = new EhCacheManager();
   cacheManager.setCacheManager(manager);
   return cacheManager;
 }
コード例 #4
0
 @Bean(name = "shiroEhcacheManager")
 public EhCacheManager getEhCacheManager() {
   EhCacheManager em = new EhCacheManager();
   em.setCacheManagerConfigFile("classpath:cache/ehcache-shiro.xml");
   return em;
 }