- 浏览: 69067 次
-
文章分类
最新评论
-
小色帝:
我是天才是打发
Jquery实现的Tabs页 -
小色帝:
小色帝 写道1111而温热
Jquery实现的Tabs页 -
小色帝:
1111而温热
Jquery实现的Tabs页
package com.paic.icorepnbs.web.util;
import com.paic.icorepnbs.common.util.LogUtils;
import com.paic.icorepnbs.common.util.SerializableUtil;
import com.paic.icorepnbs.common.util.StringUtils;
import java.util.Map;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.exceptions.JedisException;
public class RedisCacheServiceUtil
{
protected JedisPool jedisPool;
public static final String KEY_NAME_SEP = ":";
protected Jedis getJedis()
throws JedisException
{
Jedis jedis = null;
try {
jedis = this.jedisPool.getResource();
} catch (JedisException e) {
LogUtils.error("获取jedis连接异常", e, null, new Object[0]);
if (jedis != null)
this.jedisPool.returnBrokenResource(jedis);
throw e;
}
return jedis;
}
public void setObject(String key, Object object, int cacheSeconds)
{
Jedis jedis = null;
boolean isBroken = false;
try {
jedis = getJedis();
String storedKey = getRedisStoreKey(object.getClass(), key);
jedis.set(storedKey.getBytes("UTF-8"), SerializableUtil.serializable(object));
if (cacheSeconds >= 0)
jedis.expire(storedKey, cacheSeconds);
}
catch (Exception e) {
isBroken = true;
} finally {
release(jedis, isBroken);
}
}
protected String getRedisStoreKey(Class<?> clazz, String key)
{
StringBuffer keyBuffer = new StringBuffer(clazz.getName()).append(":").append(key);
return keyBuffer.toString();
}
public String getStringValue(String key)
{
String value = null;
Jedis jedis = null;
try {
jedis = getJedis();
if (jedis.exists(key).booleanValue()) {
value = jedis.get(key);
value = ((StringUtils.isNotBlank(value)) && (!("nil".equalsIgnoreCase(value)))) ? value : null;
}
}
catch (Exception e) {
LogUtils.error("InternetRquestAstrictFilter--->get异常", e, null, new Object[0]);
}
finally {
}
return value;
}
public Object getObject(String key, Class<?> clazz)
{
Jedis jedis = null;
boolean isBroken = false;
Object obj = null;
try {
jedis = getJedis();
String storedKey = getRedisStoreKey(clazz, key);
byte[] bytes = jedis.get(storedKey.getBytes("UTF-8"));
obj = SerializableUtil.deSerializable(bytes);
} catch (Exception e) {
isBroken = true;
} finally {
release(jedis, isBroken);
}
return obj;
}
public void setHashField(String redisKey, String itemKey, String value)
{
boolean isBroken = false;
Jedis jedis = null;
try {
jedis = getJedis();
jedis.hset(redisKey, itemKey, value);
} catch (JedisException e) {
isBroken = true;
LogUtils.error("redis执行失败", e, null, new Object[0]);
} finally {
release(jedis, isBroken);
}
}
public void setHashMap(String key, Map<String, String> map, int cacheSeconds)
{
boolean isBroken = false;
Jedis jedis = null;
if ((map != null) && (map.size() > 0))
try {
jedis = getJedis();
jedis.hmset(key, map);
if (cacheSeconds >= 0)
jedis.expire(key, cacheSeconds);
}
catch (JedisException e) {
isBroken = true;
LogUtils.error("redis执行失败,setHashMap(" + key + "," + map.toString() + "," + cacheSeconds + ")", e, null, new Object[0]);
}
finally
{
release(jedis, isBroken);
}
}
public Map<String, String> getHashMapByKey(String key)
{
boolean isBroken = false;
Jedis jedis = null;
Map valueMap = null;
try {
jedis = getJedis();
valueMap = jedis.hgetAll(key);
} catch (JedisException e) {
isBroken = true;
LogUtils.error("redis执行失败,getHashMapByKey(" + key + ")", e, null, new Object[0]);
} finally {
release(jedis, isBroken);
}
return valueMap;
}
public String getItemFromMap(String redisKey, String itemKey)
{
boolean isBroken = false;
Jedis jedis = null;
String result = "";
try {
jedis = getJedis();
result = jedis.hget(redisKey, itemKey);
} catch (JedisException e) {
isBroken = true;
LogUtils.error("redis执行失败,getItemFromMap", e, null, new Object[0]);
} finally {
release(jedis, isBroken);
}
return result;
}
public long removeItemFromHashMap(String redisKey, String itemKey)
{
boolean isBroken = false;
Jedis jedis = null;
try {
jedis = getJedis();
long l = jedis.hdel(redisKey, new String[] { itemKey }).longValue();
return l;
}
catch (JedisException e)
{
isBroken = true;
LogUtils.error("redis执行失败,removeItemFormHashMap(" + redisKey + "," + itemKey + ")", e, null, new Object[0]);
}
finally {
release(jedis, isBroken);
}
return 0L;
}
public void setString(String key, String value, int cacheSeconds)
{
Jedis jedis = null;
boolean isBroken = false;
try {
jedis = getJedis();
jedis.set(key, value);
if (cacheSeconds >= 0)
jedis.expire(key, cacheSeconds);
}
catch (JedisException e) {
isBroken = true;
LogUtils.error("redis执行失败;" + key + ":" + value, e, null, new Object[0]);
} finally {
release(jedis, isBroken);
}
}
public long deleteJedisByKey(String key)
{
boolean isBroken = false;
Jedis jedis = null;
try {
jedis = getJedis();
long l = jedis.del(key).longValue();
return l;
}
catch (Exception e)
{
isBroken = true;
LogUtils.error("redis执行,移除key:" + key + ",失败。", e, null, new Object[0]);
} finally {
release(jedis, isBroken);
}
return 0L;
}
public boolean existKey(String key)
{
Jedis jedis = null;
boolean isBroken = false;
try {
jedis = getJedis();
boolean bool1 = jedis.exists(key).booleanValue();
return bool1;
}
catch (Exception e)
{
isBroken = true;
LogUtils.error("existKey异常!", e, null, new Object[0]);
} finally {
release(jedis, isBroken);
}
return false;
}
public Long expire(String key, int seconds)
{
Long result = null;
boolean isBroken = false;
Jedis jedis = null;
try {
jedis = getJedis();
result = jedis.expire(key, seconds);
} catch (Exception e) {
isBroken = true;
LogUtils.error("expire异常:", e, null, new Object[0]);
} finally {
release(jedis, isBroken);
}
return result;
}
public void release(Jedis jedis, boolean isBroken) {
if (jedis != null)
if (isBroken)
this.jedisPool.returnBrokenResource(jedis);
else
this.jedisPool.returnResource(jedis);
}
public void setJedisPool(JedisPool jedisPool)
{
this.jedisPool = jedisPool;
}
}
import com.paic.icorepnbs.common.util.LogUtils;
import com.paic.icorepnbs.common.util.SerializableUtil;
import com.paic.icorepnbs.common.util.StringUtils;
import java.util.Map;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.exceptions.JedisException;
public class RedisCacheServiceUtil
{
protected JedisPool jedisPool;
public static final String KEY_NAME_SEP = ":";
protected Jedis getJedis()
throws JedisException
{
Jedis jedis = null;
try {
jedis = this.jedisPool.getResource();
} catch (JedisException e) {
LogUtils.error("获取jedis连接异常", e, null, new Object[0]);
if (jedis != null)
this.jedisPool.returnBrokenResource(jedis);
throw e;
}
return jedis;
}
public void setObject(String key, Object object, int cacheSeconds)
{
Jedis jedis = null;
boolean isBroken = false;
try {
jedis = getJedis();
String storedKey = getRedisStoreKey(object.getClass(), key);
jedis.set(storedKey.getBytes("UTF-8"), SerializableUtil.serializable(object));
if (cacheSeconds >= 0)
jedis.expire(storedKey, cacheSeconds);
}
catch (Exception e) {
isBroken = true;
} finally {
release(jedis, isBroken);
}
}
protected String getRedisStoreKey(Class<?> clazz, String key)
{
StringBuffer keyBuffer = new StringBuffer(clazz.getName()).append(":").append(key);
return keyBuffer.toString();
}
public String getStringValue(String key)
{
String value = null;
Jedis jedis = null;
try {
jedis = getJedis();
if (jedis.exists(key).booleanValue()) {
value = jedis.get(key);
value = ((StringUtils.isNotBlank(value)) && (!("nil".equalsIgnoreCase(value)))) ? value : null;
}
}
catch (Exception e) {
LogUtils.error("InternetRquestAstrictFilter--->get异常", e, null, new Object[0]);
}
finally {
}
return value;
}
public Object getObject(String key, Class<?> clazz)
{
Jedis jedis = null;
boolean isBroken = false;
Object obj = null;
try {
jedis = getJedis();
String storedKey = getRedisStoreKey(clazz, key);
byte[] bytes = jedis.get(storedKey.getBytes("UTF-8"));
obj = SerializableUtil.deSerializable(bytes);
} catch (Exception e) {
isBroken = true;
} finally {
release(jedis, isBroken);
}
return obj;
}
public void setHashField(String redisKey, String itemKey, String value)
{
boolean isBroken = false;
Jedis jedis = null;
try {
jedis = getJedis();
jedis.hset(redisKey, itemKey, value);
} catch (JedisException e) {
isBroken = true;
LogUtils.error("redis执行失败", e, null, new Object[0]);
} finally {
release(jedis, isBroken);
}
}
public void setHashMap(String key, Map<String, String> map, int cacheSeconds)
{
boolean isBroken = false;
Jedis jedis = null;
if ((map != null) && (map.size() > 0))
try {
jedis = getJedis();
jedis.hmset(key, map);
if (cacheSeconds >= 0)
jedis.expire(key, cacheSeconds);
}
catch (JedisException e) {
isBroken = true;
LogUtils.error("redis执行失败,setHashMap(" + key + "," + map.toString() + "," + cacheSeconds + ")", e, null, new Object[0]);
}
finally
{
release(jedis, isBroken);
}
}
public Map<String, String> getHashMapByKey(String key)
{
boolean isBroken = false;
Jedis jedis = null;
Map valueMap = null;
try {
jedis = getJedis();
valueMap = jedis.hgetAll(key);
} catch (JedisException e) {
isBroken = true;
LogUtils.error("redis执行失败,getHashMapByKey(" + key + ")", e, null, new Object[0]);
} finally {
release(jedis, isBroken);
}
return valueMap;
}
public String getItemFromMap(String redisKey, String itemKey)
{
boolean isBroken = false;
Jedis jedis = null;
String result = "";
try {
jedis = getJedis();
result = jedis.hget(redisKey, itemKey);
} catch (JedisException e) {
isBroken = true;
LogUtils.error("redis执行失败,getItemFromMap", e, null, new Object[0]);
} finally {
release(jedis, isBroken);
}
return result;
}
public long removeItemFromHashMap(String redisKey, String itemKey)
{
boolean isBroken = false;
Jedis jedis = null;
try {
jedis = getJedis();
long l = jedis.hdel(redisKey, new String[] { itemKey }).longValue();
return l;
}
catch (JedisException e)
{
isBroken = true;
LogUtils.error("redis执行失败,removeItemFormHashMap(" + redisKey + "," + itemKey + ")", e, null, new Object[0]);
}
finally {
release(jedis, isBroken);
}
return 0L;
}
public void setString(String key, String value, int cacheSeconds)
{
Jedis jedis = null;
boolean isBroken = false;
try {
jedis = getJedis();
jedis.set(key, value);
if (cacheSeconds >= 0)
jedis.expire(key, cacheSeconds);
}
catch (JedisException e) {
isBroken = true;
LogUtils.error("redis执行失败;" + key + ":" + value, e, null, new Object[0]);
} finally {
release(jedis, isBroken);
}
}
public long deleteJedisByKey(String key)
{
boolean isBroken = false;
Jedis jedis = null;
try {
jedis = getJedis();
long l = jedis.del(key).longValue();
return l;
}
catch (Exception e)
{
isBroken = true;
LogUtils.error("redis执行,移除key:" + key + ",失败。", e, null, new Object[0]);
} finally {
release(jedis, isBroken);
}
return 0L;
}
public boolean existKey(String key)
{
Jedis jedis = null;
boolean isBroken = false;
try {
jedis = getJedis();
boolean bool1 = jedis.exists(key).booleanValue();
return bool1;
}
catch (Exception e)
{
isBroken = true;
LogUtils.error("existKey异常!", e, null, new Object[0]);
} finally {
release(jedis, isBroken);
}
return false;
}
public Long expire(String key, int seconds)
{
Long result = null;
boolean isBroken = false;
Jedis jedis = null;
try {
jedis = getJedis();
result = jedis.expire(key, seconds);
} catch (Exception e) {
isBroken = true;
LogUtils.error("expire异常:", e, null, new Object[0]);
} finally {
release(jedis, isBroken);
}
return result;
}
public void release(Jedis jedis, boolean isBroken) {
if (jedis != null)
if (isBroken)
this.jedisPool.returnBrokenResource(jedis);
else
this.jedisPool.returnResource(jedis);
}
public void setJedisPool(JedisPool jedisPool)
{
this.jedisPool = jedisPool;
}
}
发表评论
-
c3p0代码动态切换数据源
2018-08-06 17:54 1095public class PARPDatasource imp ... -
sql 优化开多个线程跑
2018-07-11 09:54 700select /*+ parallel(8) */ * fr ... -
redis 事物限制频率和获得令牌
2018-07-11 02:50 935package com.dongnaoedu.tony.ser ... -
Redis分布式锁解决抢购问题
2018-07-11 02:39 1343废话不多说,首先分享一个业务场景-抢购。一个典型的高并发问题, ... -
StringWriter 接收异常信息
2018-07-05 18:42 455try { int a=1/0; } catch (E ... -
jedis 操作redis
2018-06-26 09:13 377//连接redis ,redis的默认端口是6379 Je ... -
多线程缓存优化思想
2018-06-06 15:33 3831.背景 题库 随机生成N张试卷,每张试卷M个题目,每个题目要 ... -
网络编程之使用HttpClient批量上传文件
2018-05-28 01:12 565网络编程之使用HttpClient批量上传文件(一) 2014 ... -
oracle 正则表达式 替换 ‘’:
2018-05-18 18:04 600select /*+ parallel(8) */ t.na ... -
java web 导出 下拉 excle
2018-05-15 17:03 480@RequestMapping(value = "/ ... -
Java Socket编程
2016-12-28 23:28 349对于Java Socket编程而言,有两个概念,一个是Serv ... -
Java多线程学习(吐血超详细总结)
2016-12-27 17:15 427目录(?)[-] 1.一扩展javalangThread类 2 ... -
JAVA多线程实现的三种方式
2016-12-27 17:16 428Java多线程实现方式主要有三种:继承Thread类、实现Ru ... -
Maven 入门菜鸟教程
2016-12-02 10:02 1194学习maven的使用,看到一篇很实用的入门教程(菜鸟级入门) ... -
Java 读写Properties配置文件
2016-08-22 15:00 414Java 读写Properties配置文件 1.Pro ... -
JAVA前端与后端参数传递方法小结
2016-07-26 10:54 46791,从Action中传值到JSP页面的方法 ①在Actio ... -
苟富贵
2013-02-25 09:43 0额梵蒂冈过v梵蒂冈北方多汇报地方环保 -
Request的getParameter和getAttribute方法的区别
2013-01-22 10:01 656HttpServletRequest.getParameter ... -
Eclipse快捷键小结
2012-12-26 11:26 749Eclipse快捷键小结 Eclipse ... -
JAVA去空格
2012-12-20 16:53 663String ccc=” he l l o , w o r l ...
相关推荐
pimpinella_3cd_01_0716
FIB English learning
X86-jq安装包
AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!
大圣挪车小程序1.3.5 前端
Manus.im 产品及开发团队研究报告.pdf
AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!
sun_3ck_01a_0918
下载 1. 单击“立即下载”,以下载该文件。 2. 出现“文件下载”窗口后,单击“保存”,以将文件保存到硬盘。 安装 1. 浏览至文件下载目标位置并双击新下载的文件。 2. 仔细阅读对话窗口中显示的发布信息。 3. 下载并安装对话窗口中标识的任何必备项,然后再继续。 4. 单击“Install”(安装)按钮。 5. 按照其余提示执行更新。 安装 1. 将解压的文件复制到可访问Windows的介质。 2. 将系统重新引导至Windows操作系统。 3. 打开“服务器管理器”->“设备管理器”->“存储控制器”,然后单击“PERC控制器”。 5. 单击“更新驱动程序软件”,并按照提示更新驱动程序。 4. 重新引导系统以使更改生效。
支持所有操作系统一键安装。
matlab程序代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!
AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!
swanson_01_1106
AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!
AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!
sun_3ck_01_0919
各城市方言距离数据-中山大学岭南学院产业与区域经济研究中心 方言距离是指两种或多种方言之间的相似程度或差异程度。参考中山大学岭南学院产业与区域经济研究中心的刘毓芸等(2015)文献。他们基于方言树图,并参考《汉语方言大词典》和《中国语言地图集》对方言的划分,将汉语方言从宽泛到具体分为以下几个层级:汉语→方言大区→方言区→方言片。为了量化县与县之间的方言差异,他们采用了一种赋值方法: 若它们分属不同方言大区,则距离为3。: 若两个县同属一个方言片,则它们之间的方言距离为0; 若两个县属于同一方言区但不同方言片,则距离为1; 若它们属于同一方言大区但不同方言区,则距离为2; 方言距离是一个反映方言之间相似程度或差异程度的重要指标,它在语音识别、方言研究等领域具有广泛的应用价值。 参考文献:[1]刘毓芸, 徐现祥, 肖泽凯. 2015. 劳动力跨方言流动的倒U型模式[J]. 经济研究, 50(10): 134-146+162. 指标 语系、语族、方言大区、方言区/语支、方言片/语种、Supergroup、Dialect、group、Sub-dialect、groupPref_1、Pref_2、DiaDist、PrefCode_1、PrefCode_2等等。
基于PCA算法的人脸识别MATLAB源码
AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!
lim_3ck_01a_0518