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

房地产电商网站建设武汉网络优化知名乐云seo

房地产电商网站建设,武汉网络优化知名乐云seo,软件公司做网站推广科目,qq空间破解版免费下载目录 Redis命令 通用命令 String Key的顶层格式 Hash List Set SortedSet Redis命令 通用命令 想知道某个命令怎么用 1.可以在官网学习用法 https://www.redis.net.cn/order/ 2. 使用 help命令 String Key的顶层格式 Hash List Set SortedSet 在IDEA使用Jedis操作…

目录

Redis命令

通用命令

String

Key的顶层格式

Hash

List

Set

SortedSet


Redis命令

通用命令

想知道某个命令怎么用

1.可以在官网学习用法

https://www.redis.net.cn/order/

2.  使用 help+命令

String

Key的顶层格式

Hash

List

Set

SortedSet

在IDEA使用Jedis操作Redis

常规使用

引入依赖

我的pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.leo</groupId><artifactId>jedis-work</artifactId><version>1.0-SNAPSHOT</version><packaging>jar</packaging><name>jedis-work</name><url>http://maven.apache.org</url><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><maven.compiler.source>1.8</maven.compiler.source><maven.compiler.target>1.8</maven.compiler.target><junit.jupiter.version>5.7.0</junit.jupiter.version></properties><dependencies><!--jedis--><dependency><groupId>redis.clients</groupId><artifactId>jedis</artifactId><version>3.7.0</version></dependency><!--单元测试--><dependency><groupId>org.junit.jupiter</groupId><artifactId>junit-jupiter</artifactId><version>5.7.0</version><scope>test</scope></dependency></dependencies><build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-surefire-plugin</artifactId><version>2.22.2</version><configuration><includes><include>**/*Test.java</include><include>**/*Tests.java</include></includes></configuration></plugin></plugins></build>
</project>

我的测试

package com.leo.test;import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import redis.clients.jedis.Jedis;
import org.junit.jupiter.api.Test;public class TestRedis {private Jedis jedis;@BeforeEachvoid setUp() {// 1.建立连接jedis = new Jedis("192.168.**.**", 6379);  //根据自己的ip// 2.设置密码jedis.auth("***");   自己的密码// 3.选择库jedis.select(0);}@Testvoid testString() {// 存入数据String result = jedis.set("name2", "大哥");System.out.println("result = " + result);// 获取数据String name = jedis.get("name2");System.out.println("name = " + name);}@AfterEachvoid tearDown() {if (jedis != null) {jedis.close();}}
}

Jedis的连接池

1.配置Jedis连接池工具类

package Utils;import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;public class JedisConnectionFactory {private static final JedisPool jedisPool;static {//配置连接池JedisPoolConfig poolConfig = new JedisPoolConfig();poolConfig.setMaxTotal(8);poolConfig.setMaxIdle(8);poolConfig.setMinIdle(0);poolConfig.setMaxWaitMillis(1000);//创建连接池对象jedisPool = new JedisPool(poolConfig,"192.168.88.134",6379,1000,"123321");}public static Jedis getJedis(){return jedisPool.getResource();}
}

建立连接使用工具类 

package com.leo.test;import Utils.JedisConnectionFactory;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import redis.clients.jedis.Jedis;
import org.junit.jupiter.api.Test;
import redis.clients.jedis.JedisFactory;
import redis.clients.jedis.JedisPool;public class TestRedis {private Jedis jedis;@BeforeEachvoid setUp() {// 1.建立连接//  方式1// jedis = new Jedis("192.168.88.134", 6379);//  方式2jedis= JedisConnectionFactory.getJedis();// 2.设置密码jedis.auth("123321");// 3.选择库jedis.select(0);}@Testvoid testString() {// 存入数据String result = jedis.set("name3", "小弟");System.out.println("result = " + result);// 获取数据String name = jedis.get("name3");System.out.println("name = " + name);}@AfterEachvoid tearDown() {if (jedis != null) {jedis.close();}}
}

http://www.dtcms.com/wzjs/458170.html

相关文章:

  • 工程建设信息网站有哪些竞价代运营外包公司
  • 网站预算表怎么做网络营销软件条件
  • 大学生做网站怎么赚钱seo是什么
  • 阿里云建站的优缺点域名停靠
  • 烟台市福山区住房和建设局网站网盘app下载
  • 西宁做网站的工作室百度收录方法
  • 课程设计代做网站推荐搜狗站长工具
  • 域名备案怎么关闭网站吗百度seo价格查询系统
  • 建盏公司官方网站seo手机关键词排行推广
  • 广西政府网站谁做的代做百度关键词排名
  • 网站建设教学设计如何做网址
  • 招聘网站哪个平台比较好深圳网页设计
  • 做淘宝客网站骗钱深圳网络推广公司哪家好
  • 贵阳商城网站建设seo辅助优化工具
  • 域名空间商界面长春网站建设方案优化
  • 焦作网站制作东莞公司seo优化
  • 做网站什么价位网页制作费用大概多少
  • 做企业宣传片的网站优化公司治理结构
  • 徐州市城乡建设局网站6站长seo推广
  • 中小型网站建设哪家好百度seo推广价格
  • 不建网站如何做淘宝客做网页用什么软件好
  • 字幕组 主页 wordpress关键词优化最好的方法
  • 黄埔网站建设设计怎么建个人网站
  • 人人车的网站找谁做的百度指数分析报告
  • 网站做行测题搭建一个网站
  • 做网站个体户执照百度一下照片识别
  • 福田商城网站建设友情链接查询工具
  • 二级建造师证件查询成都seo优化推广
  • 十大纯净系统网站站长工具精华
  • 网站开发所需人才域名注册网站查询