Jedis使用工具類

2022-03-20 08:16:25 字數 1864 閱讀 1350

redis 使用工具類:

package com.qlwb.business.common.redis;

import org.apache.log4j.logger;

import redis.clients.jedis.jedis;

import redis.clients.jedis.jedispool;

import redis.clients.jedis.jedispoolconfig;

import com.aspire.boc.util.resourcemanager;

public class redispool catch (exception e)

}/**

* 獲取jedis例項

* * @return

*/public static jedis getjedis()

else

} catch (exception e)

}/**

* 返還到連線池

* * @param jedis

*/public static void returnresource(final jedis jedis)

} /**

* 釋放jedis資源

* * @param jedis

*/ public static void returnbrokenresource(final jedis jedis)

} /**

* * @方法名稱:get

* @內容摘要: <直接從從庫中獲得資訊>

* @param key

* @return

* string

* @exception

* @author:鹿偉偉

* @建立日期:2023年3月16日-上午10:52:22

*/ public static string get(string key) catch (exception e) finally

return value;

} /**

* * @方法名稱:set

* @內容摘要: <設定資料>

* @param key

* @param value

* void

* @exception

* @author:鹿偉偉

* @建立日期:2023年3月3日-上午10:34:50

*/ public static void set(string key,string value) catch (exception e) finally

} /**

* * @方法名稱:expire

* @內容摘要: <設定資料有限時間>

* @param key

* @param time

* void

* @exception

* @author:鹿偉偉

* @建立日期:2023年3月3日-上午10:37:51

*/ public static void expire(string key,int time) catch (exception e) finally

} public static boolean exists(string key) catch (exception e) finally

return false;

} /**

* @param args

*/ public static void main(string args) catch (interruptedexception e)

} }

}

常用工具類

本講內容 常用工具類 陸續更新 author administrator public static context context public void oncreate public static context getcontext 2 提供所有activity呼叫 基類 author ad...

常用工具類

reflectionutils objectutils public static void main string args 判斷兩個陣列是否相等 system.out.println arrays.equals arr,arr true 列印陣列 string s1 arrays.tostrin...

Redis的使用工具方法類以及Redis鎖的使用

redis在實際工作的幾種使用方法,其中最吸引筆者的是redis在分布式鎖方面的應用。在第二段 中我會貼出筆者在練習中蘇哦用的 功能描述 redis的幾種常用工具方法,其中redis分布式鎖注意setifabsent方法的使用 param return auther rhine date 2018 ...