TypechoJoeTheme

香草物语

统计
登录
用户名
密码
/
注册
用户名
邮箱
输入密码
确认密码
搜索到 6 篇与 的结果
2023-03-05

SprintBoot切面+Redis防止前端重复提交

SprintBoot切面+Redis防止前端重复提交
最近项目上遇到重复提交的情况,虽然前端对按钮进行了禁用,但是不知道是什么原因,后端仍然接收到了多个请求,因为是分布式系统,所以不能简单的使用lock,最终考虑决定使用redis实现。一、环境准备MySql:测试数据库Redis:使用Redis实现Another Redis Desktop Manager:跟踪Redis信息ApiFox:模拟请求,单线程循环及多线程循环Spring Boot:2.7.4二、准备测试数据及接口2.1、创建表创建一个最简单的用户表,只包含id、name两列create table User ( id int null, name varchar(200) null );2.2、创建接口2.2.1、配置依赖及数据库、Redis连接信息项目依赖<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi=&...
Laughing
2023-03-05

Java

593 阅读
1 评论
2023年03月05日
593 阅读
1 评论
2020-10-02

spring boot使用Redis

spring boot使用Redis
什么是RedisRedis(Remote Dictionary Server ),即远程字典服务,是一个开源的使用ANSI C语言编写、支持网络、可基于内存亦可持久化的日志型、Key-Value数据库,并提供多种语言的API。从2010年3月15日起,Redis的开发工作由VMware主持。从2013年5月开始,Redis的开发由Pivotal赞助。Redis官网:https://redis.io/spring boot 使用Redis添加依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency>修改application.yaml在配置文件中,增加redis配置信息增加Redis配置类/** * Redis配置 * @author laughing * @date 2020/...
Laughing
2020-10-02

Java

1,244 阅读
0 评论
2020年10月02日
1,244 阅读
0 评论
2020-10-01

在windows上安装Redis

在windows上安装Redis
前言Redis官方不建议在windows下使用Redis,所以官网没有windows版本可以下载。还好微软团队维护了开源的window版本,虽然只有3.2版本,对于普通测试使用足够了。Windows Redis下载地址https://github.com/MicrosoftArchive/redis/releases注意点击Asset,展开就能看到对应的安装包。Windows Redis使用我相信没有任何人在实际项目中,会在Win下使用Redis。(如果有,就当我这句话没说)如上所述,所以我不讲解如果通过.msi的方式进行安装。(尽管都是一样的),我们这里介绍.zip的方式进行安装(使用)。解压下载的.zip文件将redis路径添加到环境变量cmd启动redis如果已经将redis路径添加到path,执行redis-server.exeredis会自动加载redis目录下的redis.windows.conf配置文件,当然,你也可以执行配置文件位置,就像下面这样redis-server.exe C:\Users\laughing\Documents\Redis-x64-3.2.1...
Laughing
2020-10-01

Java

1,143 阅读
0 评论
2020年10月01日
1,143 阅读
0 评论
2020-10-01

另一个 Redis 桌面管理工具- Another-Redis-Desktop-Manager

另一个 Redis 桌面管理工具- Another-Redis-Desktop-Manager
AnotherRedisDesktopManager是国人开源的一个Redis客户端。它是一款更快、更好、更稳定的 Redis 桌面管理工具,兼容 Linux, windows, mac。更重要的是,在加载大量的键时它不会崩溃!AnotherRedisDesktopManager也是我最近一直使用的redis客户端。项目地址:https://github.com/qishibo/AnotherRedisDesktopManager新建连接点击“新建链接”,输入redis信息,点击确定,如果配置都正确,即可建立链接控制台使用如下图,点击控制台图标,输入相应命令,即可执行新增、查看键值
Laughing
2020-10-01

Java

1,844 阅读
0 评论
2020年10月01日
1,844 阅读
0 评论
2019-07-22

Spring Boot通过Redis共享Session

Spring Boot通过Redis共享Session
温馨提示以下内容基于SpringBoot 1.2.7版本<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.2.7.RELEASE</version> </parent>添加依赖主要是添加如下两个依赖<!-- 添加redis--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-redis</artifactId> <version>...
Laughing
2019-07-22

Java

1,129 阅读
0 评论
2019年07月22日
1,129 阅读
0 评论
2017-11-25

ASP.NET Core使用Redis

ASP.NET Core使用Redis
Redis是优秀的缓存组件,我们在DotNetCore中也能够很方便的使用。本文主要介绍在虚拟机安装Window Server作为缓存服务器进行简单使用的方法。使用准备为了使用Redis,我们需要一个缓存服务器,这里我们所有的东西都是通过Nuget的方式进行安装的。需要注意的是,Redis官方没有Win版本的,但是我们可以使用微软第三方的我们首先需要安装一下的Nuget包Microsoft.AspNetCore.Session Microsoft.AspNetCore.Http.Extensions Microsoft.Extensions.Caching.Redis Redis-64其中Redis位于C:\Users\Administrator.nuget\packages\redis-64将Redis-64文件夹拷贝到服务器,然后打开\3.0.503\tools\redis-server.exe 开启Redis
Laughing
2017-11-25

Java

1,128 阅读
0 评论
2017年11月25日
1,128 阅读
0 评论