package com.example.redisdemo.service.impl;
import com.example.redisdemo.service.PoemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
/**
* @BelongsProject: RedisDemo
* @BelongsPackage: com.example.redisdemo.service
* @Author: TRXCX-JZX
* @CreateTime: 2024-03-02 10:14
* @Description: TODO
* @Version: 1.0
*/
@Service
public class PoemServiceImpl implements PoemService {
@Autowired
private StringRedisTemplate template;
@Override
public Integer readNumberIncr(Long id) {
// key不存在时会自动创建一个key
String key = "poem_readNumber_" + id;
// value增加后,redis返回的就是增加后的值
return template.opsForValue().increment(key).intValue();
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
RedisDemo.zip
共30个文件
xml:8个
java:5个
class:4个
需积分: 0 1 下载量 22 浏览量
2024-03-02
12:01:36
上传
评论
收藏 245KB ZIP 举报
温馨提示
资源介绍请参考: https://blog.csdn.net/TRXCXS/article/details/136412070?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22136412070%22%2C%22source%22%3A%22TRXCXS%22%7D
资源推荐
资源详情
资源评论
收起资源包目录
RedisDemo.zip (30个子文件)
HELP.md 860B
mvnw.cmd 7KB
pom.xml 2KB
src
test
java
com
example
redisdemo
RedisDemoApplicationTests.java 225B
main
resources
templates
static
detail.html 1KB
jquery-3.7.1.js 279KB
application.yml 52B
java
com
example
redisdemo
RedisDemoApplication.java 332B
controller
PoemController.java 817B
service
PoemService.java 135B
impl
PoemServiceImpl.java 897B
.mvn
wrapper
maven-wrapper.properties 233B
maven-wrapper.jar 61KB
.idea
jarRepositories.xml 864B
uiDesigner.xml 9KB
workspace.xml 4KB
misc.xml 607B
inspectionProfiles
Project_Default.xml 406B
compiler.xml 715B
.gitignore 190B
encodings.xml 191B
target
classes
static
detail.html 1KB
jquery-3.7.1.js 279KB
application.yml 52B
com
example
redisdemo
RedisDemoApplication.class 758B
controller
PoemController.class 1006B
service
PoemService.class 233B
impl
PoemServiceImpl.class 2KB
generated-sources
annotations
mvnw 11KB
.gitignore 395B
共 30 条
- 1
资源评论
TRXCX
- 粉丝: 306
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功