A self hosted chat application with end-to-end encrypted messaging.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

47 lines
1.5 KiB

package org.ros.chatto.config;
import org.ros.chatto.security.MyUserDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.core.userdetails.UserCache;
import org.springframework.security.core.userdetails.cache.SpringCacheBasedUserCache;
@EnableCaching
@Configuration
public class CacheConfig {
@Autowired
private CacheManager cacheManager;
@Bean
public UserCache userCache() throws Exception {
// return new EhCacheBasedUserCache();
// Cache cache = (Cache) cacheManager().getCache("userCache");
Cache cache = cacheManager.getCache("chatUser");
return new SpringCacheBasedUserCache(cache);
}
// private net.sf.ehcache.CacheManager cacheManager;
// @PreDestroy
// public void destroy() {
// cacheManager.shutdown();
// }
//
// @Bean
// public CacheManager cacheManager() {
//// log.debug("Starting Ehcache");
// cacheManager = net.sf.ehcache.CacheManager.create();
// cacheManager.getConfiguration().setMaxBytesLocalHeap("16M");
// EhCacheCacheManager ehCacheManager = new EhCacheCacheManager();
// ehCacheManager.setCacheManager(cacheManager);
// return ehCacheManager;
// }
}