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

jsp做的网站源码专业单位网站开发

jsp做的网站源码,专业单位网站开发,重庆快速排名,如何做一个网页设计方案提前总结#xff0c;因此项目已多处使用Redis1 故此我创建的Redis工厂只添加了Redis2并不影响Redis1。但如若还有Redis3、4、5可按照下述方法继续往Redis工厂里添加 下述代码添加到 RedisConfig import org.springframework.beans.factory.annotation.Autowired; import org…提前总结因此项目已多处使用Redis1 故此我创建的Redis工厂只添加了Redis2并不影响Redis1。但如若还有Redis3、4、5可按照下述方法继续往Redis工厂里添加 下述代码添加到 RedisConfig import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.data.redis.core.BoundSetOperations; import org.springframework.data.redis.core.HashOperations; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.ValueOperations; import org.springframework.stereotype.Component;Value(${custom.redis.host})private String customRedisHost;Value(${custom.redis.port})private int customRedisPort;Bean(customRedisConnectionFactory)public RedisConnectionFactory customRedisConnectionFactory() {LettuceConnectionFactory lettuceConnectionFactory new LettuceConnectionFactory(customRedisHost, customRedisPort);lettuceConnectionFactory.setDatabase(1);return lettuceConnectionFactory;}Bean(customRedisTemplate)public RedisTemplateObject, Object customRedisTemplate(RedisConnectionFactory customRedisConnectionFactory) {RedisTemplateObject, Object redisTemplate new RedisTemplate();redisTemplate.setConnectionFactory(customRedisConnectionFactory);redisTemplate.setDefaultSerializer(new StringRedisSerializer()); // 默认使用StringRedisSerializerreturn redisTemplate;}yml文件 custom:redis:host: 127.0.0.1port: 6379database: 1#password:Redis工具类 package com.ruoyi.common.core.redis;import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.data.redis.core.BoundSetOperations; import org.springframework.data.redis.core.HashOperations; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.ValueOperations; import org.springframework.stereotype.Component;import java.util.*; import java.util.concurrent.TimeUnit;/*** spring redis 工具类** author ruoyi**/ SuppressWarnings(value { unchecked, rawtypes }) Component public class Redis2Cache {AutowiredQualifier(customRedisTemplate)public RedisTemplate redisTemplate;/*** 缓存基本的对象Integer、String、实体类等** param key 缓存的键值* param value 缓存的值*/public T void setCacheObject(final String key, final T value){redisTemplate.opsForValue().set(key, value);}/*** 缓存基本的对象Integer、String、实体类等** param key 缓存的键值* param value 缓存的值* param timeout 时间* param timeUnit 时间颗粒度*/public T void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit){redisTemplate.opsForValue().set(key, value, timeout, timeUnit);}/*** 设置有效时间** param key Redis键* param timeout 超时时间* return true设置成功false设置失败*/public boolean expire(final String key, final long timeout){return expire(key, timeout, TimeUnit.SECONDS);}/*** 设置有效时间** param key Redis键* param timeout 超时时间* param unit 时间单位* return true设置成功false设置失败*/public boolean expire(final String key, final long timeout, final TimeUnit unit){return redisTemplate.expire(key, timeout, unit);}/*** 获得缓存的基本对象。** param key 缓存键值* return 缓存键值对应的数据*/public T T getCacheObject(final String key){ValueOperationsString, T operation redisTemplate.opsForValue();return operation.get(key);}/*** 删除单个对象** param key*/public boolean deleteObject(final String key){return redisTemplate.delete(key);}/*** 删除集合对象** param collection 多个对象* return*/public long deleteObject(final Collection collection){return redisTemplate.delete(collection);}/*** 缓存List数据** param key 缓存的键值* param dataList 待缓存的List数据* return 缓存的对象*/public T long setCacheList(final String key, final ListT dataList){Long count redisTemplate.opsForList().rightPushAll(key, dataList);return count null ? 0 : count;}/*** 获得缓存的list对象** param key 缓存的键值* return 缓存键值对应的数据*/public T ListT getCacheList(final String key){return redisTemplate.opsForList().range(key, 0, -1);}/*** 缓存Set** param key 缓存键值* param dataSet 缓存的数据* return 缓存数据的对象*/public T BoundSetOperationsString, T setCacheSet(final String key, final SetT dataSet){BoundSetOperationsString, T setOperation redisTemplate.boundSetOps(key);IteratorT it dataSet.iterator();while (it.hasNext()){setOperation.add(it.next());}return setOperation;}/*** 获得缓存的set** param key* return*/public T SetT getCacheSet(final String key){return redisTemplate.opsForSet().members(key);}/*** 缓存Map** param key* param dataMap*/public T void setCacheMap(final String key, final MapString, T dataMap){if (dataMap ! null) {redisTemplate.opsForHash().putAll(key, dataMap);}}/*** 获得缓存的Map** param key* return*/public T MapString, T getCacheMap(final String key){return redisTemplate.opsForHash().entries(key);}/*** 往Hash中存入数据** param key Redis键* param hKey Hash键* param value 值*/public T void setCacheMapValue(final String key, final String hKey, final T value){redisTemplate.opsForHash().put(key, hKey, value);}/*** 获取Hash中的数据** param key Redis键* param hKey Hash键* return Hash中的对象*/public T T getCacheMapValue(final String key, final String hKey){HashOperationsString, String, T opsForHash redisTemplate.opsForHash();return opsForHash.get(key, hKey);}/*** 删除Hash中的数据* * param key* param hKey*/public void delCacheMapValue(final String key, final String hKey){HashOperations hashOperations redisTemplate.opsForHash();hashOperations.delete(key, hKey);}/*** 获取多个Hash中的数据** param key Redis键* param hKeys Hash键集合* return Hash对象集合*/public T ListT getMultiCacheMapValue(final String key, final CollectionObject hKeys){return redisTemplate.opsForHash().multiGet(key, hKeys);}/*** 获得缓存的基本对象列表** param pattern 字符串前缀* return 对象列表*/public CollectionString keys(final String pattern){return redisTemplate.keys(pattern);} }
http://www.dnsts.com.cn/news/119217.html

相关文章:

  • 伊春市住房和城乡建设局网站在站点上新建网页
  • 众筹网站建设费用百度网站收录提交
  • 灯光设计网站推荐沧州网站建设 网络服务
  • 衡水网站建设公司在线登录qq邮箱网页版官网
  • 个人网站 免费自己做的网站怎么在百度上搜到
  • 鑫菲互动网站建设公司六安马启兵轮轩案
  • 网站开发实训报告模板企业网站建设方案机构
  • 赣州市规划建设局网站改微信开店哪个平台好
  • wordpress 社区模版南宁外包seo服务
  • 赣州市城乡建设局官方网站文创产品推广方案
  • 做网站的准备什么软件广州17网
  • 南昌电影网站开发海洋高端的专业做网站
  • 网站建设的局限性wordpress联系方式插件
  • 小购物网站建设重庆建筑网络平台
  • 营销型网站建设电话做二手房需要用到哪些网站搜集房源
  • 做去自己的网站首页一浪网站建设
  • 开发公司工程部经理述职报告济南软件优化网站建设
  • 中企动力官网网站网站建设法律法规
  • 空间 两个网站家具公司网站建设
  • 十大免费文案网站如何做品牌营销
  • 网站维护方式大学网页制作与网站建设
  • destoon 网站后台岳阳网站设计改版
  • 手机网站建设如何做英文网站 赚美元
  • 中卫市住房建设局网站网站安全维护包括什么
  • 网站首页结构图怎么才服务器上做网站
  • 阿里云做淘宝客网站个人网站的名字
  • html5建设网站旅游网站建设与设计
  • 正规外贸网站建设公司网站建站的作用
  • 网站改版怎么做佛山网站制作专业公司
  • 免费做网站方案网站建设与域名备案