5 changed files with 116 additions and 14 deletions
-
13.idea/libraries/Maven__ch_qos_logback_logback_classic_1_2_3.xml
-
4xm-bootstrap/src/main/java/com/xm/WebSecurityConfig.java
-
3xm-core/src/main/java/com/xm/core/ctrl/XmQuestionController.java
-
75xm-core/src/main/java/com/xm/core/ctrl/XmTaskController.java
-
35xm-core/src/main/java/com/xm/core/service/cache/XmTaskCacheService.java
@ -1,13 +0,0 @@ |
|||||
<component name="libraryTable"> |
|
||||
<library name="Maven: ch.qos.logback:logback-classic:1.2.3"> |
|
||||
<CLASSES> |
|
||||
<root url="jar://$MAVEN_REPOSITORY$/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/" /> |
|
||||
</CLASSES> |
|
||||
<JAVADOC> |
|
||||
<root url="jar://$MAVEN_REPOSITORY$/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3-javadoc.jar!/" /> |
|
||||
</JAVADOC> |
|
||||
<SOURCES> |
|
||||
<root url="jar://$MAVEN_REPOSITORY$/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3-sources.jar!/" /> |
|
||||
</SOURCES> |
|
||||
</library> |
|
||||
</component> |
|
||||
@ -0,0 +1,35 @@ |
|||||
|
package com.xm.core.service.cache; |
||||
|
|
||||
|
import com.xm.core.entity.XmProject; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.data.redis.core.RedisTemplate; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.concurrent.TimeUnit; |
||||
|
|
||||
|
@Service |
||||
|
public class XmTaskCacheService { |
||||
|
|
||||
|
@Autowired |
||||
|
RedisTemplate redisTemplate; |
||||
|
|
||||
|
String getCacheKey() { |
||||
|
return "xm_task"; |
||||
|
} |
||||
|
public void putTasks(String queryKeys, List<Map<String,Object>> tasks){ |
||||
|
String key=this.getCacheKey()+"_"+queryKeys; |
||||
|
String hashKey=key; |
||||
|
redisTemplate.opsForHash().put(key, hashKey, tasks); |
||||
|
redisTemplate.expire(hashKey, 24, TimeUnit.HOURS); |
||||
|
} |
||||
|
|
||||
|
public List<Map<String,Object>> getTasks(String queryKeys){ |
||||
|
String key=this.getCacheKey()+"_"+queryKeys; |
||||
|
String hashKey=key; |
||||
|
return (List<Map<String,Object>>) redisTemplate.opsForHash().get(key, hashKey); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue