Redis应用一例(存证数量用计数器实现)
2024-09-25 14:06:04
public Long getCreationCounter() {
String host =PropertyUtils.getPropertyValue("redis.server.host");
String port =PropertyUtils.getPropertyValue("redis.server.port");
String password =PropertyUtils.getPropertyValue("redis.server.password");
jedis = new Jedis(host,Integer.parseInt(port));
if(password != null && password.length()>0){
jedis.auth(password);
}
String count = jedis.get(REDIS_COUNT_STROAGEEVIDENCE);
jedis.close();
return Long.parseLong(count);
}
<select id="getCount" resultType="long">
select count(1) from m_storage_evidence
</select>
@Override
public long getCount() throws ServiceException {
// TODO Auto-generated method stub
return stroageEvidenceMapper.getCount(); } @Override
public void executeStroageEvidenceCount() throws ServiceException {
// TODO Auto-generated method stub
Long count = getCount();
System.out.println(CybMain.properties_version);
String host =PropertiesUtils.getValueByKey(CybMain.properties_version, "redis.server.host");
String port =PropertiesUtils.getValueByKey(CybMain.properties_version, "redis.server.port");
String password = PropertiesUtils.getValueByKey(CybMain.properties_version, "redis.server.password");
jedis = new Jedis(host,Integer.parseInt(port));
if(password != null && password.length()>0){
jedis.auth(password);
}
jedis.set("countStroageEvidence", count+"");
jedis.close(); }
最新文章
- 下拉框-ComboBox
- Selenium FF WebDriver运行时开启firebug的2种方式
- 关于JDK的配置
- 京东2017 C++一面
- 如何“任性”使用Android的drawText()
- 8,SSO,,eager copy,COW
- RH033读书笔记(9)-Lab 10 Understanding the Configuration Tools
- 使用Chrome DevTools的Timeline和Profiles提高Web应用程序的性能
- esri-leaflet入门教程(5)- 动态要素加载
- 浏览器未安装flash插件,js判断直接去官网安装
- 字典树trie
- Linux 使用 top 命令查看系统的运行情况
- mtu简单说明
- 地图api
- Java 就业班 Web框架
- 安装Jade
- css布局记录之双飞翼布局、圣杯布局
- drupal7 覆写node-type.tpl.php获取字段值的两种方式
- Web自动化测试框架Watir(基于Ruby) - 第2章 使用Watir写自动化测试脚本
- 程序员必看:给你一份详细的Spring Boot知识清单
热门文章
- luogu P4146 序列终结者
- https://leetcode.com/problems/palindromic-substrings/description/
- 617. Merge Two Binary Trees
- 搭建OpenResty(Nginx+Lua)
- Android学习之基础知识二(build.gradle文件详解)
- jdk和cglib简单理解
- 1-微信小程序开发(安装软件和运行第一个微信小程序)
- 分析网络流量Capsa笔记
- 在IIS上部署你的ASP.NET Core项目 (转载)
- 介绍一个axios调试好用的工具:axios-mock-adapter