Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ufo
/
yohoufo-fore
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
wujiexiang
6 years ago
Commit
8eca553ea3a8060cc5fba7241546bd3ab0647da4
1 parent
4f291095
redis test
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
promotion/src/main/java/com/yohoufo/promotion/controller/RedisTestController.java
promotion/src/main/java/com/yohoufo/promotion/controller/RedisTestController.java
0 → 100644
View file @
8eca553
package
com
.
yohoufo
.
promotion
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.yohoufo.common.annotation.IgnoreSession
;
import
com.yohoufo.common.annotation.IgnoreSignature
;
import
com.yohoufo.common.cache.CacheClient
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
/**
* Created by jiexiang.wu on 2018/11/21.
*/
@Controller
@RequestMapping
(
value
=
"/redis"
)
public
class
RedisTestController
{
@Autowired
private
CacheClient
cacheClient
;
@RequestMapping
(
"/redis_get"
)
@ResponseBody
@IgnoreSession
@IgnoreSignature
public
String
get
(
@RequestParam
String
key
,
@RequestParam
String
className
)
{
try
{
Class
clazz
=
Class
.
forName
(
className
);
Object
result
=
cacheClient
.
get
(
key
,
clazz
);
return
JSON
.
toJSONString
(
result
);
}
catch
(
Exception
ex
)
{
return
"happen exception"
;
}
}
@RequestMapping
(
"/redis_delete"
)
@ResponseBody
@IgnoreSession
@IgnoreSignature
public
String
delete
(
@RequestParam
String
key
)
{
cacheClient
.
delete
(
key
);
return
"ok"
;
}
}
...
...
Please
register
or
login
to post a comment