File tree Expand file tree Collapse file tree 3 files changed +30
-2
lines changed
src/main/java/com/flow/platform/api/config Expand file tree Collapse file tree 3 files changed +30
-2
lines changed Original file line number Diff line number Diff line change 6565 <artifactId >gson</artifactId >
6666 </dependency >
6767
68+ <dependency >
69+ <groupId >org.springframework</groupId >
70+ <artifactId >spring-context-support</artifactId >
71+ </dependency >
72+
6873 <dependency >
6974 <groupId >org.hibernate</groupId >
7075 <artifactId >hibernate-validator</artifactId >
Original file line number Diff line number Diff line change 1616
1717package com .flow .platform .api .config ;
1818
19+ import com .google .common .cache .CacheBuilder ;
20+ import java .util .concurrent .TimeUnit ;
1921import org .springframework .cache .CacheManager ;
2022import org .springframework .cache .annotation .EnableCaching ;
21- import org .springframework .cache .concurrent . ConcurrentMapCacheManager ;
23+ import org .springframework .cache .guava . GuavaCacheManager ;
2224import org .springframework .context .annotation .Bean ;
2325import org .springframework .context .annotation .Configuration ;
2426
2931@ EnableCaching
3032public class CachingConfig {
3133
34+ private final static int EXPIRE_CACHE_SECOND = 3600 * 24 ;
35+
36+ private final static int MAX_CACHE_NUM = 1000 ;
37+
38+
39+ private CacheBuilder cacheBuilder = CacheBuilder
40+ .newBuilder ()
41+ .expireAfterAccess (EXPIRE_CACHE_SECOND , TimeUnit .SECONDS )
42+ .maximumSize (MAX_CACHE_NUM );
43+
44+
3245 @ Bean
3346 public CacheManager cacheManager () {
34- return new ConcurrentMapCacheManager ();
47+ GuavaCacheManager guavaCacheManager = new GuavaCacheManager ();
48+ guavaCacheManager .setCacheBuilder (cacheBuilder );
49+ return guavaCacheManager ;
3550 }
3651}
Original file line number Diff line number Diff line change 5757 <javax .mail.version>1.5.5</javax .mail.version>
5858 <yamlbeans .version>1.12</yamlbeans .version>
5959 <velocity .version>1.5</velocity .version>
60+ <spring-context-support .version>4.3.8.RELEASE</spring-context-support .version>
6061 </properties >
6162
6263 <build >
9495
9596 <dependencyManagement >
9697 <dependencies >
98+
99+ <dependency >
100+ <groupId >org.springframework</groupId >
101+ <artifactId >spring-context-support</artifactId >
102+ <version >${spring-context-support.version} </version >
103+ </dependency >
104+
97105 <dependency >
98106 <groupId >javax.mail</groupId >
99107 <artifactId >javax.mail-api</artifactId >
You can’t perform that action at this time.
0 commit comments