Subversion Repositories SmartDukaan

Rev

Rev 22552 | Rev 22872 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
22009 ashik.ali 1
package com.spice.profitmandi.dao.config;
2
 
3
import java.util.concurrent.TimeUnit;
4
 
5
import org.springframework.cache.CacheManager;
6
import org.springframework.cache.annotation.CachingConfigurerSupport;
7
import org.springframework.cache.annotation.EnableCaching;
8
import org.springframework.cache.guava.GuavaCacheManager;
9
import org.springframework.context.annotation.Bean;
10
import org.springframework.context.annotation.Configuration;
11
 
12
import com.google.common.cache.CacheBuilder;
13
 
14
@Configuration
15
@EnableCaching
16
public class CacheConfig extends CachingConfigurerSupport{
17
	@Override
18
 
19
	@Bean
20
	public CacheManager cacheManager() {
21
	    GuavaCacheManager cacheManager = new GuavaCacheManager();
22
	    return cacheManager;
23
	}
24
 
25
	@Bean
26
	public CacheManager timeoutCacheManager() {
27
	    GuavaCacheManager cacheManager = new GuavaCacheManager();
22552 amit.gupta 28
	    CacheBuilder<Object, Object> cacheBuilder = CacheBuilder.newBuilder().expireAfterWrite(5, TimeUnit.MINUTES);
22009 ashik.ali 29
	    cacheManager.setCacheBuilder(cacheBuilder);
30
	    return cacheManager;
31
	}
32
 
22708 amit.gupta 33
	@Bean
34
	public CacheManager twoMintimeoutCacheManager() {
35
		GuavaCacheManager cacheManager = new GuavaCacheManager();
36
		CacheBuilder<Object, Object> cacheBuilder = CacheBuilder.newBuilder().expireAfterWrite(2, TimeUnit.MINUTES);
37
		cacheManager.setCacheBuilder(cacheBuilder);
38
		return cacheManager;
39
	}
40
 
22009 ashik.ali 41
}