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.
34 lines
868 B
34 lines
868 B
5 years ago
|
package org.airsonic.player.spring;
|
||
|
|
||
|
import net.sf.ehcache.Ehcache;
|
||
|
import net.sf.ehcache.constructs.web.ShutdownListener;
|
||
|
import org.airsonic.player.cache.CacheFactory;
|
||
|
import org.springframework.context.annotation.Bean;
|
||
|
import org.springframework.context.annotation.Configuration;
|
||
|
|
||
|
import javax.servlet.ServletContextListener;
|
||
|
|
||
|
@Configuration
|
||
|
public class EhcacheConfiguration {
|
||
|
|
||
|
@Bean
|
||
|
public ServletContextListener ehCacheShutdownListener() {
|
||
|
return new ShutdownListener();
|
||
|
}
|
||
|
|
||
|
@Bean
|
||
|
public Ehcache userCache(CacheFactory cacheFactory) {
|
||
|
return cacheFactory.getCache("userCache");
|
||
|
}
|
||
|
|
||
|
@Bean
|
||
|
public Ehcache mediaFileMemoryCache(CacheFactory cacheFactory) {
|
||
|
return cacheFactory.getCache("mediaFileMemoryCache");
|
||
|
}
|
||
|
|
||
|
@Bean
|
||
|
public CacheFactory cacheFactory() {
|
||
|
return new CacheFactory();
|
||
|
}
|
||
|
}
|