当前位置: 首页 > news >正文

岳阳网站建设开发温州在线制作网站

岳阳网站建设开发,温州在线制作网站,网站建设人员培训纲要,iis8 wordpressredisson提供了很多对象类型的api#xff0c;下面介绍下一些常用的对象api。 RBucket 可操作任何对象的api#xff0c;前提是要确定好泛型#xff0c;方法比较少。大小限制为512Mb。 RBucketAnyObject bucket redisson.getBucket(anyObject);bucket…        redisson提供了很多对象类型的api下面介绍下一些常用的对象api。  RBucket 可操作任何对象的api前提是要确定好泛型方法比较少。大小限制为512Mb。 RBucketAnyObject bucket redisson.getBucket(anyObject);bucket.set(new AnyObject(1)); AnyObject obj bucket.get();bucket.trySet(new AnyObject(3)); bucket.compareAndSet(new AnyObject(4), new AnyObject(5)); bucket.getAndSet(new AnyObject(6)); RMap 专门操作map的对象实现了ConcurrentMap接口并且put、set操作直接作用于redis。 RMapString, SomeObject map redisson.getMap(anyMap); SomeObject prevObject map.put(123, new SomeObject()); SomeObject currentObject map.putIfAbsent(323, new SomeObject()); SomeObject obj map.remove(123);// use fast* methods when previous value is not required map.fastPut(a, new SomeObject()); map.fastPutIfAbsent(d, new SomeObject()); map.fastRemove(b);RFutureSomeObject putAsyncFuture map.putAsync(321); RFutureVoid fastPutAsyncFuture map.fastPutAsync(321);map.fastPutAsync(321, new SomeObject()); map.fastRemoveAsync(321); RList 专门操作list的对象实现了java.util.List add、set等方法直接作用于redis。 RListSomeObject list redisson.getList(anyList); list.add(new SomeObject()); list.get(0); list.remove(new SomeObject()); 自定义工具类代码  package com.springboot.demo.base.utils;import java.time.Duration; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; import org.apache.commons.lang3.ObjectUtils; import org.redisson.api.RBucket; import org.redisson.api.RList; import org.redisson.api.RLock; import org.redisson.api.RMap; import org.redisson.api.RedissonClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component;/*** description: redisson工具类 br* author: 小花卷的Dad br* create: 2023/8/24 br*/ Component public class RedissonUtil {private static RedissonClient redissonClient;/*** 锁默认释放时间*/private static final long default_lease_time 5L;Autowiredpublic void setRedissonClient(RedissonClient redissonClient) {RedissonUtil.redissonClient redissonClient;}/*** key是否存在* param key* return*/public static boolean isExists(String key){return redissonClient.getBucket(key).isExists();}/*** 获取生命周期* param key* return*/public static long getExpireTime(String key){return redissonClient.getBucket(key).remainTimeToLive();}/*** 设置生命周期* param key* param time(毫秒)* return*/public static boolean setExpireTime(String key, Long expire){return redissonClient.getBucket(key).expire(Duration.ofMillis(expire));}public static boolean delete(String key){if(!isExists(key)){return true;}return redissonClient.getBucket(key).delete();}/*** 保存字符串* param key* param value*/public static void setStr(String key, String value){RBucketString rBucket redissonClient.getBucket(key);rBucket.set(value);}/*** 保存字符串* param key* param value* param expire*/public static void setStr(String key, String value, Long expire){RBucketString rBucket redissonClient.getBucket(key);rBucket.set(value, Duration.ofMillis(expire));}/*** 查询字符串* param key* return*/public static String getStr(String key){if(isExists(key)){return null;}RBucketString rBucket redissonClient.getBucket(key);return rBucket.get();}/*** 保存对象* param key* param value* param T*/public static T void setObject(String key, T value){RBucketT rBucket redissonClient.getBucket(key);rBucket.set(value);}/*** 保存对象* param key* param value* param expire* param T*/public static T void setObject(String key, T value, Long expire){RBucketT rBucket redissonClient.getBucket(key);rBucket.set(value, Duration.ofMillis(expire));}/*** 查询对象* param key* return*/public static T T getObject(String key){RBucketT rBucket redissonClient.getBucket(key);return rBucket.get();}/*** map.get* param key* param mapKey* param T* return*/public static T T mapGet(String key, String mapKey){if(!isExists(key)){return null;}MapString, T rMap redissonClient.getMap(key);return rMap.get(mapKey);}/*** 查询map* param key* param T* return*/public static T MapString, T mapGetAll(String key){RMapString, T rMap redissonClient.getMap(key);return rMap.readAllMap();}/*** map.put* param key* param mapKey* param mapValue* param T*/public static T void mapPut(String key, String mapKey,T mapValue){RMapString, T rMap redissonClient.getMap(key);rMap.put(mapKey, mapValue);}/*** map.putAll* param key* param map* param T*/public static T void mapPutAll(String key, MapString, T map){RMapString, T rMap redissonClient.getMap(key);rMap.putAll(map);}/*** map.contains* param key* param mapKey* return*/public static boolean mapContains(String key, String mapKey){if(!isExists(key)){return false;}MapString, Object rMap redissonClient.getMap(key);return rMap.containsKey(mapKey);}/*** list.get* param key* param listIndex* param T* return*/public static T T listGet(String key, int listIndex){if(!isExists(key)){return null;}if(listIndex 0){return null;}RListT rList redissonClient.getList(key);if(rList.size()-1 listIndex){return null;}return rList.get(listIndex);}/*** list.getAll* param key* param T* return*/public static T ListT listGetAll(String key){RListT rList redissonClient.getList(key);return rList.readAll();}/*** list.add* param key* param addValue* param T*/public static T void listAdd(String key, T addValue){RListT rList redissonClient.getList(key);rList.add(addValue);}/*** list.add* param key* param addList* param T*/public static T void listAddAll(String key, ListT addList){RListT rList redissonClient.getList(key);rList.addAll(addList);}/*** list.set* param key* param listIndex* param setValue* param T*/public static T void listSet(String key, int listIndex, T setValue){RListT rList redissonClient.getList(key);if(rList.size()-1 listIndex){return;}rList.set(listIndex, setValue);} }
http://www.pierceye.com/news/186766/

相关文章:

  • 做网站排名优化的公司无需下载直接登录qq手机版
  • 网站不备案不能访问吗wordpress主题开发404页面
  • 工作总结个人总结自动app优化下载
  • 网站开发推荐书籍比较大的外贸网站
  • 上饶建设网站郑州网
  • 做淘宝客网站一定要备案吗没有网站域名备案
  • 用QQ群做网站排名慈溪网站制作哪家最好
  • 兴宁市网站建设手工艺品网站建设策划书
  • flash做网站导航网站品牌建设流程
  • 公司建设网站属于什么费用网站打模块
  • 网站建设应注意的问题网站备案验证码错误
  • 网站核验点网站自己怎么做的
  • 购物网站建设平台canvas可画网页版
  • 企业信息平台系统网站推广优化建设
  • 免费网站模板制作自助建站上建的网站免费吗
  • 深圳市网站建设外包公司门户网站代码结构
  • 昆明做网站建设找谁最新版在线 网
  • 东昌府聊城网站建设网站广告做的好的企业案例分析
  • asp三层架构做网站网站开发前端基础
  • 医院网站建设方案策划书把网站做成app的软件下载
  • 网站建设实践报告3000字wordpress消息提示插件
  • 网站制作的评价标准做网站后台需要什么
  • 学院网站建设服务宗旨实惠的网站建设产品
  • 网站改名 备案影视制作
  • 网站开发亿码酷技术网站建设选谋者
  • 智能家居网站模板怎样做网站标题优化
  • 深圳制作网站制作公司哪家好最简洁 wordpress主题
  • 重庆忠县网站建设公司推荐国内公关公司
  • 给彩票网站做代理违法吗wordpress文章与页面关联
  • 网站标题加后缀模拟ip访问网站