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.
33 lines
868 B
33 lines
868 B
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();
|
|
}
|
|
}
|
|
|