ICode9

精准搜索请尝试: 精确搜索
  • SpringBoot配置Redis多集群数据源2021-12-10 16:31:08

    Redis 三大客户端 简介 Jedis:是Redis 老牌的Java实现客户端,提供了比较全面的Redis命令的支持, Redisson:实现了分布式和可扩展的Java数据结构。 Lettuce:高级Redis客户端,用于线程安全同步,异步和响应使用,支持集群,Sentinel,管道和编码器。 优点: Jedis:比较全面的提供了Redis的操作特性

  • RedisUtil写法,好用2021-12-06 10:02:59

      代码: import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; import java.util.List; impo

  • Spring Data Redis应用场景分析2021-12-05 16:32:52

    在Spring Boot中,默认集成的redis是Spring Data Redis。Spring Data Redis针对redis提供了非常方便的操作模版RedisTemplate,同时又提供了StringRedisTemplate。本文来谈谈二者的关系: StringRedisTemplate继承RedisTemplate。 两者的数据是不共通的;也就是说StringRedisTemplate只

  • SpringBoot 整合 Redis2021-12-04 17:31:16

    概述 1.1 SpringData SpringBoot 操作数据都是使用 ——SpringData 以下是 Spring 官网中描述的 SpringData 可以整合的数据源 可以发现 Spring Data Redis 1.2 lettuce 在 SpringBoot 2.X 之后,原来的 Jedis 被替换为了 lettuce Jedis 和 lettuce 区别 Jedis :采用的是直连的服

  • 重学SpringBoot系列之redis与spring cache缓存2021-12-03 09:34:20

    重学SpringBoot系列之redis缓存 使用docker安装redis准备工作获取 redis 镜像 创建容器创建持久化存储目录获取 redis 的默认配置文件模版使用镜像创建一个容器查看活跃的容器 访问 redis 容器服务开启防火墙端口,提供外部访问 redis数据结构与应用场景Redis 基本数据结构与

  • Spring整合Redis分布式锁2021-12-02 10:00:40

    1.导包<spring.boot.version>2.2.6.RELEASE</spring.boot.version> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> <version>${spring.boot.v

  • 使用redis的zset实现简单的延时队列2021-12-02 01:31:06

    一、需求切入点    在公司做的一个系统业务需要有个定时提醒的功能(数据在mysql中),要求提醒的时间差精准到分钟 解决方案有: 使用定时器,每分钟执行一次,查符合提醒的数据,发起提醒(数据库连接与系统的负载都承受不住的!!) 将待提醒数据提前查出存进redis中,根据提醒时间设置过期时间,做r

  • SpringBoot整合Redis2021-11-27 15:03:31

    SpringBoot整合Redis 1、引入pom依赖 <!-- redis--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency&g

  • 自定义RedisTemplate2021-11-25 17:01:35

    import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.PropertyAccessor; import com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.context.annotation.Bean; import org.springframework.context.a

  • 通过RedisTemplate在本地java后端项目使用redis2021-11-25 11:33:00

    一、在虚拟机安装好redis 我安装的目录是/usr/local 二、修改配置文件 bind 0.0.0.0 #修改bind后面的ip为这个 protected-mode no #protected-mode修改yes为no 三、启动redis 进入bin目录(/usr/local/redis/bin      启动redis(按照修改好后的配置文件) ./redis-server /usr/

  • springboot整合Redis之RedisUtils工具类2021-11-24 22:04:54

    @Component public final class RedisUtil { @Autowired private RedisTemplate<String, Object> redisTemplate; // =============================common============================ /** * 指定缓存失效时间 * @param key 键 * @param ti

  • 解决Spring Boot 使用RedisTemplate 存储键值出现乱码 \xac\xed\x00\x05t\x002021-11-24 20:58:00

    最近使用spring-data-redis RedisTemplate 操作redis时发现存储在redis中的key不是设置的string值,前面还多出了许多类似\xac\xed\x00\x05t\x00这种字符串,如下 127.0.0.1:6379> keys * 1) "\xac\xed\x00\x05t\x00\x04pass" 2) "\xac\xed\x00\x05t\x00\x04name" 3) "n

  • Redis2021-11-24 12:31:17

    一、lettuce 依赖: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId>

  • SpringBoot集成redis2021-11-14 19:03:23

    SpringBoot集成redis 1.通过注解方式 1.1导入依赖 implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-redis', version: '2.4.10' 1.2 在yml文件中配置redis spring: redis: host: localhost password: port:

  • Java秒杀系统(十四):基于Redis的原子操作优化秒杀逻辑2021-11-13 16:58:55

    摘要:本篇博文是“Java秒杀系统实战系列文章”的第十四篇,本文将借助缓存中间件Redis的“单线程”特性及其原子操作一同优化“秒杀系统中秒杀的核心业务逻辑”,彻底初步解决“库存超卖”、“重复秒杀”等问题。 内容:对于缓存中间件Redis,相信各位小伙伴或多或少都有听说过,甚至实战过

  • 大白话讲解调用Redis的increment失败原因及推荐使用2021-11-10 13:01:15

            大家在项目中基本都会接触到redis,在spring-data-redis-2.*.*.RELEASE.jar中提供了两个Helper class,可以让我们更方便的操作redis中存储的数据。这两个Helper class分别是RedisTemplate和StringRedisTemplate,其中StringRedisTemplate是RedisTemplate在存储String类型的

  • Redis 事物2021-11-06 19:59:06

    事物是一组命令的集合,一个事务中的所有的命令都会被序列化后按顺序执行,中间不会被其它命令插入 multi/exec redisTemplate.setEnableTransactionSupport(true); // 开启事务支持 redisTemplate.multi();// 开启事务 redisTemplate.opsForValue().set(stockKey, --stock); //

  • RedisTemplate方法详解2021-11-04 22:58:01

    maven依赖 <!--redis--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> <!--<version>2.1.4.RELEASE</v

  • SpringBoot整合reids之JSON序列化文件夹操作2021-11-04 09:31:06

    前言 最近在开发项目,用到了redis作为缓存,来提高系统访问速度和缓解系统压力,提高用户响应和访问速度,这里遇到几个问题做一下总结和整理 快速配置 SpringBoot整合redis有专门的场景启动器整合起来还是非常方便的 <dependency> <groupId>org.springframework.boot</gr

  • new 创建的对象,通过注入方式获取RedisTemplate,报空指针异常2021-11-02 14:33:15

    有一次需要使用RedisTemplate,通过@Autowired方式注入,使用的时候一致报空指针,后来发现该对象由于业务关系时new 来的,无法获取spring容器对象 使用工具类 @Component public class SpringUtils implements ApplicationContextAware { private static ApplicationContext appl

  • Spring-boot集成Redis2021-11-01 21:02:00

    pom文件 <!-- springboot整合redis --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> <version>2.5.6&

  • 第12章 Spring Security JWT登录2021-10-29 16:05:55

    什么是JWT JWS 是 JSON Web Token 的缩写,用JSON作为对象在系统之间安全地传输信息。关于JWT更多信息,请参考阮一峰的 JSON Web Token 入门教程 注意:本章是基于第三章 Spring Security基于数据库登录实现的 Maven依赖 <!-- 新增redis依赖 --> <dependency> <groupId>org.sp

  • 一个自己使用的RedisUtil工具类2021-10-28 02:00:31

    RedisUtil工具类: package top.linzeliang.utils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Component; import org.springframework.util.Collecti

  • 5.5-RedisTemplate的序列和反序列化机制讲解《小滴课堂-新版Redis6学习笔记》2021-10-27 15:03:02

      整理不易,点点小编,一键三连走一波~~~  笔记来自《小滴课堂-新版Redis6学习笔记》 第5集 RedisTemplate的序列和反序列化机制讲解 简介:RedisTemplate的序列和反序列化机制讲解 上集问题 同个key为啥获取不到值,核心就是序列化机制导致key不一样 什么是序列化 把对象转换为字

  • Redis笔记 spring boot简单整合redis2021-10-21 18:32:42

    简介: Redis(Remote Dictionary Server ):远程字典服务, 是一个key-value数据库 安装: https://github.com/tporadowski/redis/releases 打开直接下载zip压缩包解压即可 解压后: 打开命令框(终端)开始运行redis redis-server.exe redis.windows.conf 导入依赖: pom.xml: <!--redis--

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有