SpringBoot整合Redis,基于Jedis实现redis各种操作

news2024/9/20 1:02:22

前言(三步教你学会redis,主打一个实用)

springboot整合redis步骤,并基于jedis对redis数据库进行相关操作,最后分享非常好用、功能非常全的redis工具类。

第一步:导入maven依赖

<!--	springboot整合redis	-->
<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>

<dependency>
	<groupId>redis.clients</groupId>
	<artifactId>jedis</artifactId>
</dependency>

说明:第一个是引入springboot整合redis的依赖,通常引入这个依赖已经可以用redis了,但是不方便。所以引入jedis依赖用于方便操作redis。

第二步:写配置文件

# jedis 手动配置
redis:
  host: 100.111.111.11
  port: 6379
  auth: 123456
  timeOut: 3000

说明:正常配置是在spring.redis.xxx,咱们是用jedis操作,所以写自己的配置路径。

第三步:代码实现

首先我们先写个配置类,用于获取jedis实例:

package com.zlp.cps.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;


@Component
public class MyJedisPoolConfig {

    private MyJedisPoolConfig() {
    }


    //redis主机的ip
    private static String host;

    //redis主机的端口号
    private static int port;
    //登录口令
    private static String auth;
    /**
     * 连接超时和读写超时(单位ms)
     * 读写超时即:redis对该命令执行时间太长,超过设定时间后就放弃本次请求
     */
    private static int connAndReadWriteTimeOut;


    /**
     * 通过非静态的setter来给静态的属性赋值
     *
     * @param redisHost
     */
    @Value("${redis.host}")
    public void setRedisHost(String redisHost) {
        MyJedisPoolConfig.host = redisHost;
    }

    @Value("${redis.port}")
    public void setRedisPort(int redisPort) {
        MyJedisPoolConfig.port = redisPort;
    }

    @Value("${redis.auth}")
    public void setAuth(String redisAuth) {
        MyJedisPoolConfig.auth = redisAuth;
    }

    @Value("${redis.timeOut}")
    public void setAuth(int timeOut) {
        MyJedisPoolConfig.connAndReadWriteTimeOut = timeOut;
    }


    private static class innerClass {

        //静态内部类保存一个jedisPool的实例
        private static JedisPool jedisPool = new JedisPool(getConfig(), host, port, connAndReadWriteTimeOut, auth);

        private static JedisPoolConfig getConfig() {
            JedisPoolConfig poolConfig = new JedisPoolConfig();
            //========= jedisPool的一些配置=============================
            poolConfig.setMaxTotal(10000);//最大连接数
            poolConfig.setMaxIdle(50);//最多空闲数
            poolConfig.setMaxWaitMillis(5 * 1000);//当池中没有连接时,最多等待5秒
            return poolConfig;
        }
    }

    /**
     * 返回jedisPool实例
     *
     * @return
     */
    public static JedisPool getJedisPool() {
        return innerClass.jedisPool;
    }

}

获取到jedis实例后就可以做相关操作了,下面是通用的工具类:

package com.zlp.cps.util;

import com.zlp.cps.config.MyJedisPoolConfig;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.Pipeline;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * 基于jedis整合redis工具类
 *
 * @author zlp
 * @date 2023/9/13
 **/
public final class RedisUtils {
 
   /*
    除了该工具类提供的方法外,还可以在外面调用getJedis()方法,获取到jedis实例后,调用它原生的api来操作
     */
 
    /**
     * 获取jedis对象,并选择redis库。jedis默认是0号库,可传入1-16之间的数选择库存放数据
     * 原则上使用一个redis库存放数据,通过特定的key的命令规则来区分不同的数据就行了。
     *
     * @param index redis库号。使用可变参数的目的就是该参数可传可不传。
     * @return 返回jedis对象
     */
    public static Jedis getJedis(int... index) {
        Jedis jedis = MyJedisPoolConfig.getJedisPool().getResource();
        if (index != null && index.length > 0) {
            if (index[0] > 0 && index[0] <= 16){
                jedis.select(index[0]);
            }
        }
        return jedis;
    }
 
    /*########################  key的操作  ################################*/
 
    /**
     * 根据pattern返回当前库中的key
     *
     * @param pattern
     * @return
     */
    public static Set<String> keys(String pattern) {
        Jedis jedis = null;
        Set<String> keys = null;
        try {
            jedis = getJedis();
            keys = jedis.keys(pattern);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return keys;
    }
 
    /**
     * 删除一个或多个key
     *
     * @param key 一个或多个key
     */
    public static Long del(String... key) {
        Jedis jedis = null;
        Long delNum = 0L;
        try {
            jedis = getJedis();
            delNum =jedis.del(key);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return delNum;
    }
 
    /**
     * 批量删除
     * @param keyList 要删除的key的集合
     */
    public static void mdel(List<String> keyList){
        Jedis jedis = getJedis();
        //获取pipeline
        Pipeline pipeline = jedis.pipelined();
        for (String key : keyList) {
            pipeline.del(key);
        }
        //执行结果同步,这样才能保证结果的正确性。实际上不执行该方法也执行了上面的命令,但是结果确不一定完全正确。
        //注意
        pipeline.sync();
        //关闭连接
        jedis.close();
    }
 
    /**
     * 判断某个key是否还存在
     *
     * @param key key
     * @return
     */
    public static Boolean exists(String key) {
        Jedis jedis = null;
        Boolean flag = false;
        try {
            jedis = getJedis();
            flag = jedis.exists(key);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return flag;
    }
 
    /**
     * 设置某个key的过期时间,单位秒
     *
     * @param key key
     * @param seconds 过期时间秒
     */
    public static void expire(String key, int seconds) {
        Jedis jedis = null;
        try {
            jedis = getJedis();
            jedis.expire(key, seconds);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
    }
 
    /**
     * 查看某个key还有几秒过期,-1表示永不过期 ,-2表示已过期
     *
     * @param key key
     * @return
     */
    public static Long timeToLive(String key) {
        Jedis jedis = null;
        Long ttl;
        try {
            jedis = getJedis();
            ttl = jedis.ttl(key);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return ttl;
    }
 
    /**
     * 查看某个key对应的value的类型
     *
     * @param key
     * @return
     */
    public static String type(String key) {
        Jedis jedis = null;
        String type = null;
        try {
            jedis = getJedis();
            type = jedis.type(key);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return type;
    }
 
 
    /*########################  string(字符串)的操作  ####################*/
 
    /**
     * 获取某个key的value,类型要对,只能value是string的才能获取
     *
     * @param key
     * @return
     */
    public static String get(String key) {
        Jedis jedis = null;
        String value = null;
        try {
            jedis = getJedis();
            value = jedis.get(key);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return value;
    }
 
    /**
     * 设置某个key的value
     *
     * @param key
     * @param value
     */
    public static void set(String key, String value) {
        Jedis jedis = null;
        try {
            jedis = getJedis();
            jedis.set(key, value);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
    }
 
    /**
     * 字符串后追加内容
     *
     * @param key key
     * @param appendContent 要追加的内容
     */
    public static void append(String key, String appendContent) {
        Jedis jedis = null;
        try {
            jedis = getJedis();
            jedis.append(key, appendContent);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
    }
 
    /**
     * 返回key的value的长度
     *
     * @param key
     * @return
     */
    public static Long strlen(String key) {
        Jedis jedis = null;
        Long strLen = 0L;
        try {
            jedis = getJedis();
            strLen = jedis.strlen(key);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return strLen;
    }
 
    /**
     * value 加1 必
     * 须是字符型数字
     * @param key
     * @return 增加后的值
     */
    public static Long incr(String key) {
        Jedis jedis = null;
        Long incrResult = 0L;
        try {
            jedis = getJedis();
            incrResult = jedis.incr(key);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return incrResult;
    }
 
    /**
     * value 减1   必须是字符型数字
     *
     * @param key
     * @return
     */
    public static Long decr(String key) {
        Jedis jedis = null;
        Long decrResult = 0L;
        try {
            jedis = getJedis();
            decrResult = jedis.decr(key);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return decrResult;
    }
 
    /**
     * value 加increment
     *
     * @param key key
     * @param increment 加几
     * @return
     */
    public static Long incrby(String key, int increment) {
        Jedis jedis = null;
        Long incrByResult = 0L;
        try {
            jedis = getJedis();
            incrByResult = jedis.incrBy(key, increment);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return incrByResult;
    }
 
    /**
     * value 减increment
     *
     * @param key
     * @param increment
     * @return
     */
    public static Long decrby(String key, int increment) {
        Jedis jedis = null;
        Long decrByResult = 0L;
        try {
            jedis = getJedis();
            decrByResult = jedis.decrBy(key, increment);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return decrByResult;
    }
 
    /**
     * 给某个key设置过期时间和value,成功返回OK
     *
     * @param key key
     * @param seconds 过期时间秒
     * @param value 设置的值
     * @return
     */
    public static String setex(String key, int seconds, String value) {
        Jedis jedis = null;
        String result = null;
        try {
            jedis = getJedis();
            result = jedis.setex(key, seconds, value);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return result;
    }
 
 
    /*########################  list(列表)的操作  #######################*/
    //lpush rpush lpop rpop lrange lindex llen lset
 
    /**
     * 从左边向列表中添加值
     *
     * @param key key
     * @param str 要添加的值
     */
    public static void lpush(String key, String str) {
        Jedis jedis = null;
        try {
            jedis = getJedis();
            jedis.lpush(key, str);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
    }
 
    /**
     * 从右边向列表中添加值
     *
     * @param key key
     * @param str 要添加的值
     */
    public static void rpush(String key, String str) {
        Jedis jedis = null;
        try {
            jedis = getJedis();
            jedis.rpush(key, str);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
    }
 
    /**
     * 从左边取出一个列表中的值
     *
     * @param key
     * @return
     */
    public static String lpop(String key) {
        Jedis jedis = null;
        String lpop = null;
        try {
            jedis = getJedis();
            lpop = jedis.lpop(key);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return lpop;
    }
 
    /**
     * 从右边取出一个列表中的值
     *
     * @param key
     * @return
     */
    public static String rpop(String key) {
        Jedis jedis = null;
        String rpop = null;
        try {
            jedis = getJedis();
            rpop = jedis.rpop(key);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return rpop;
    }
 
    /**
     * 取出列表中指定范围内的值,0 到 -1 表示全部
     *
     * @param key
     * @param startIndex
     * @param endIndex
     * @return
     */
    public static List<String> lrange(String key, int startIndex, int endIndex) {
        Jedis jedis = null;
        List<String> result = null;
        try {
            jedis = getJedis();
            result = jedis.lrange(key, startIndex, endIndex);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return result;
    }
 
    /**
     * 返回某列表指定索引位置的值
     *
     * @param key 列表key
     * @param index 索引位置
     * @return
     */
    public static String lindex(String key, int index) {
        Jedis jedis = null;
        String lindex = null;
        try {
            jedis = getJedis();
            lindex = jedis.lindex(key, index);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return lindex;
    }
 
    /**
     * 返回某列表的长度
     *
     * @param key
     * @return
     */
    public static Long llen(String key) {
        Jedis jedis = null;
        Long llen = 0L;
        try {
            jedis = getJedis();
            llen = jedis.llen(key);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return llen;
    }
 
    /**
     * 给某列表指定位置设置为指定的值
     *
     * @param key
     * @param index
     * @param str
     */
    public static void lset(String key, Long index, String str) {
        Jedis jedis = null;
        try {
            jedis = getJedis();
            jedis.lset(key, index, str);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
    }
 
    /**
     * 对列表进行剪裁,保留指定闭区间的元素(索引位置也会重排)
     * @param key 列表key
     * @param startIndex 开始索引位置
     * @param endIndex 结束索引位置
     */
    public static void ltrim(String key,Integer startIndex,Integer endIndex){
        Jedis jedis = null;
        try {
            jedis = getJedis();
            jedis.ltrim(key, startIndex, endIndex);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
    }
 
    /**
     * 从列表的左边阻塞弹出一个元素
     * @param key 列表的key
     * @param timeout 阻塞超时时间,0表示若没有元素就永久阻塞
     * @return
     */
    public static List<String> blpop(String key,Integer timeout){
        Jedis jedis = null;
        List<String> valueList = null;
        try {
            jedis = getJedis();
            valueList = jedis.blpop(timeout, key);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return valueList;
    }
 
    /**
     * 从列表的右边阻塞弹出一个元素
     * @param key 列表的key
     * @param timeout 阻塞超时时间,0表示若没有元素就永久阻塞
     * @return
     */
    public static List<String> brpop(String key,Integer timeout){
        Jedis jedis = null;
        List<String> valueList = null;
        try {
            jedis = getJedis();
            valueList = jedis.brpop(timeout, key);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return valueList;
    }
 
 
    /*########################  hash(哈希表)的操作  #######################*/
    //hset hget hmset hmget hgetall hdel hkeys hvals hexists hincrby
 
    /**
     * 给某个hash表设置一个键值对
     *
     * @param key
     * @param field
     * @param value
     */
    public static void hset(String key, String field, String value) {
        Jedis jedis = null;
        try {
            jedis = getJedis();
            jedis.hset(key, field, value);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
    }
 
    /**
     * 取出某个hash表中某个field对应的value
     *
     * @param key key
     * @param field field
     * @return
     */
    public static String hget(String key, String field) {
        Jedis jedis = null;
        String hget = null;
        try {
            jedis = getJedis();
            hget = jedis.hget(key, field);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return hget;
    }
 
    /**
     * 某个hash表设置一个或多个键值对
     *
     * @param key
     * @param kvMap
     */
    public static void hmset(String key, Map<String, String> kvMap) {
        Jedis jedis = null;
        try {
            jedis = getJedis();
            jedis.hmset(key, kvMap);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
    }
 
    /**
     * 取出某个hash表中任意多个key对应的value的集合
     *
     * @param key
     * @param fields
     * @return
     */
    public static List<String> hmget(String key, String... fields) {
        Jedis jedis = null;
        List<String> hmget = null;
        try {
            jedis = getJedis();
            hmget = jedis.hmget(key, fields);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return hmget;
    }
 
    /**
     * 取出某个hash表中所有的键值对
     *
     * @param key
     * @return
     */
    public static Map<String, String> hgetall(String key) {
        Jedis jedis = null;
        Map<String, String> kvMap = null;
        try {
            jedis = getJedis();
            kvMap = jedis.hgetAll(key);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return kvMap;
    }
 
    /**
     * 判断某个hash表中的某个key是否存在
     *
     * @param key
     * @param field
     * @return
     */
    public static Boolean hexists(String key, String field) {
        Jedis jedis = null;
        Boolean exists = null;
        try {
            jedis = getJedis();
            exists = jedis.hexists(key, field);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return exists;
    }
 
    /**
     * 返回某个hash表中所有的key
     *
     * @param key
     * @return
     */
    public static Set<String> hkeys(String key) {
        Jedis jedis = null;
        Set<String> keys = null;
        try {
            jedis = getJedis();
            keys = jedis.hkeys(key);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return keys;
    }
 
    /**
     * 返回某个hash表中所有的value
     *
     * @param key
     * @return
     */
    public static List<String> hvals(String key) {
        Jedis jedis = null;
        List<String> hvals = null;
        try {
            jedis = getJedis();
            hvals = jedis.hvals(key);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return hvals;
    }
 
    /**
     * 删除某个hash表中的一个或多个键值对
     *
     * @param key
     * @param fields
     */
    public static void hdel(String key, String... fields) {
        Jedis jedis = null;
        try {
            jedis = getJedis();
            jedis.hdel(key, fields);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
    }
 
    /**
     * 给某个hash表中的某个field的value增加多少
     *
     * @param key       hash表的key
     * @param field     表中的某个field
     * @param increment 增加多少
     * @return
     */
    public static Long hincrby(String key, String field, Long increment) {
        Jedis jedis = null;
        Long result = null;
        try {
            jedis = getJedis();
            result = jedis.hincrBy(key, field, increment);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return result;
    }
 
    /*########################  set(集合)的操作  ###########################*/
 
    /**
     * 往set集合中添加一个或多个元素
     * @param key key
     * @param members 要添加的元素
     * @return 添加成功的元素个数
     */
    public static Long sadd(String key,String... members){
        Jedis jedis = null;
        Long num = 0L;
        try {
            jedis = getJedis();
            num = jedis.sadd(key, members);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return num;
    }
 
    /**
     * 返回set集合中的所有元素,顺序与加入时的顺序一致
     * @param key key
     * @return
     */
    public static Set<String> smembers(String key){
        Jedis jedis = null;
        Set<String> members = null;
        try {
            jedis = getJedis();
            members = jedis.smembers(key);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return members;
    }
 
    /**
     * 判断集合中是否存在某个元素
     * @param key key
     * @param member 某个元素
     * @return true存在,false不存在
     */
    public static Boolean sismember(String key,String member){
        Jedis jedis = null;
        Boolean isMember = false;
        try {
            jedis = getJedis();
            isMember = jedis.sismember(key, member);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return isMember;
    }
 
    /**
     * 返回set集合的长度
     * @param key key
     * @return
     */
    public static Long scard(String key){
        Jedis jedis = null;
        Long len = 0L;
        try {
            jedis = getJedis();
            len = jedis.scard(key);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return len;
    }
 
    /**
     * 删除set集合中指定的一个或多个元素
     * @param key
     * @param members 要删除的元素
     * @return 删除成功的元素个数
     */
    public static Long srem(String key,String... members){
        Jedis jedis = null;
        Long num = 0L;
        try {
            jedis = getJedis();
            num = jedis.srem(key,members);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return num;
    }
 
    /**
     * 将key1中的元素key1Member移动到key2中
     * @param key1 来源集合key
     * @param key2 目的地集合key
     * @param key1Member key1中的元素
     * @return 1成功,0失败
     */
    public static Long smove(String key1,String key2,String key1Member){
        Jedis jedis = null;
        Long num = 0L;
        try {
            jedis = getJedis();
            num = jedis.smove(key1,key2,key1Member);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return num;
    }
 
    /**
     * 随机查询返回集合中的指定个数的元素(若count为负数,返回的元素可能会重复)
     * @param key key
     * @param count 要查询返回的元素个数
     * @return 元素list集合
     */
    public static List<String> srandmember(String key,int count){
        Jedis jedis = null;
        List<String> members = null;
        try {
            jedis = getJedis();
            members = jedis.srandmember(key,count);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return members;
    }
 
    /**
     * 从set集合中随机弹出指定个数个元素
     * @param key key
     * @param count 要弹出的个数
     * @return 随机弹出的元素
     */
    public static Set<String> spop(String key,int count){
        Jedis jedis = null;
        Set<String> members = null;
        try {
            jedis = getJedis();
            members = jedis.spop(key,count);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return members;
    }
 
    /**
     * 求交集,返回多个set集合相交的部分
     * @param setKeys 多个set集合的key
     * @return 相交的元素集合
     */
    public static Set<String> sinter(String... setKeys){
        Jedis jedis = null;
        Set<String> members = null;
        try {
            jedis = getJedis();
            members = jedis.sinter(setKeys);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return members;
    }
 
    /**
     * 求并集,求几个set集合的并集(因为set中不会有重复的元素,合并后的集合也不会有重复的元素)
     * @param setKeys 多个set的key
     * @return 合并后的集合
     */
    public static Set<String> sunion(String... setKeys){
        Jedis jedis = null;
        Set<String> members = null;
        try {
            jedis = getJedis();
            members = jedis.sunion(setKeys);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return members;
    }
 
    /**
     * 求差集,求几个集合之间的差集
     * @param setKeys 多个set的key
     * @return 差集
     */
    public static Set<String> sdiff(String... setKeys){
        Jedis jedis = null;
        Set<String> members = null;
        try {
            jedis = getJedis();
            members = jedis.sdiff(setKeys);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return members;
    }
 
 
    /*########################  zset(有序集合)的操作  #######################*/
 
    /**
     * 添加一个元素到zset
     * @param key key
     * @param score 元素的分数
     * @param member 元素
     * @return 成功添加的元素个数
     */
    public static Long zadd(String key,double score, String member){
        Jedis jedis = null;
        Long num = null;
        try {
            jedis = getJedis();
            num = jedis.zadd(key,score,member);
        }finally {
            if (jedis != null){
                jedis.close();
            }
        }
        return num;
    }
}

最后进行测试:Test

    @Test
    public void redisTest() {
        RedisUtils.set("test","测试 test");
    }

查看redis 数据库:
在这里插入图片描述
成功!!!!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1006019.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

C++之智能指针shared_ptr死锁问题(二百)

简介&#xff1a; CSDN博客专家&#xff0c;专注Android/Linux系统&#xff0c;分享多mic语音方案、音视频、编解码等技术&#xff0c;与大家一起成长&#xff01; 优质专栏&#xff1a;Audio工程师进阶系列【原创干货持续更新中……】&#x1f680; 人生格言&#xff1a; 人生…

Hadoop生态圈中的Flume数据日志采集工具

Hadoop生态圈中的Flume数据日志采集工具 一、数据采集的问题二、数据采集一般使用的技术三、扩展&#xff1a;通过爬虫技术采集第三方网站数据四、Flume日志采集工具概述五、Flume采集数据的时候&#xff0c;核心是编写Flume的采集脚本xxx.conf六、Flume案例实操1、采集一个网络…

卫星地图-航拍影像-叠加配准套合(ArcGIS版)

卫星地图-航拍影像-叠加配准套合(ArcGIS版) 发布时间&#xff1a;2018-01-17 版权&#xff1a;BIGEMAP 第一步 工具准备 BIGEMAP地图下载器&#xff1a;Bigemap系列产品-GIS行业基础软件kml\shp 相关教程&#xff1a;CAD文件直接导入BIGEMAP进行套合配准&#xff08;推荐&am…

苹果笔不用原装可以吗?苹果ipad触控笔推荐

很多小伙伴在纠结&#xff0c;是否要购买apple pencil呢&#xff1f;但它的价格太过昂贵&#xff0c;很多学生党都消费不起。答案是不一定的要入手apple pencil的。市面上也是有做得相当不错的平替电容笔。现在无纸化已经快成为我们生活中的一部分&#xff0c;它不仅是可以书写…

新网站怎么优化才能提升排名-彻底解决新网站没收录和排名的问题

新网站怎么优化才能提升排名&#xff1f;辛辛苦苦搭建起网站后&#xff0c;却不知如何优化网站提升排名&#xff0c;也没有一个完整的思路和策略&#xff0c;今天做为行业资深SEO的我&#xff0c;来为大家理清SEO思路&#xff0c;彻底解决新网站没收录和排名的问题&#xff01;…

网站不收录没排名降权怎么处理-紧急措施可恢复网站

网站降权对于SEO人员来说是非常致命的打击&#xff0c;因为网站一旦被搜索引擎降权&#xff0c;排名会严重地下降&#xff0c;网站的流量也会大幅下降&#xff0c;直接影响到收益。而且处理不好的话会导致恢复的时间周期无限拉长&#xff0c;所以网站被降权后我们要第一时间采取…

8月客户文章盘点——累计IF 168.4,平均IF 8.42

客户文章一览 凌恩生物以打造国内一流生物公司为目标&#xff0c;在科研测序领域深耕不辍&#xff0c;吸纳多名在生物信息高级技术人员的加盟&#xff0c;参与并完成多个高科技项目。现已在宏组学、基因组、表观遗传以及蛋白代谢等多组学及联合分析领域积累了深厚经验&#xff…

软件测试总结1

1、 什么是软件测试? 答: 软件测试是在规定的条件下对程序进行操作&#xff0c;以发现错误&#xff0c;对软件质量进行评估。 什么是软件测试&#xff1a; 明确地提出了软件测试以检验是否满足需求为目标。 1、保证软件质量的重要手段 预期 ≈ 实际 2、 软件测试的意义 给…

其它机器访问mysql配置

其它机器访问mysql配置 搜索工具 叫 Everything 一、mysql - 改my.ini 刷脚本 也可能叫其他名字 编辑 bind-address0.0.0.0 编辑然后重启一下mysql服务任务管理器-关掉mysql 编辑 搜索 计算机管理-重启mysql服务 编辑 然后 打开查询&#xff0c;并选择mysql数据&#x…

分享微信聊天记录恢复的3个简单方法!

无论身在何处&#xff0c;微信是我们与家人、好友保持紧密联系的好帮手。微信聊天记录不仅仅只是几句话、几张照片……更多的是聊天记录中承载着的美好回忆。如果不小心将聊天记录删除了怎么办&#xff1f;微信聊天记录恢复的方法有哪些&#xff1f;接下来&#xff0c;小编将以…

解决IntelliJ IDEA执行maven打包,执行java -jar命令提示jar中没有主清单属性

问题场景 IDEA执行mvn clean package -DskipTesttrue命令或者借助工具的Maven菜单进行打包操作&#xff0c;然后执行java -jar app.jar命令后&#xff0c;提示jar中没有主清单属性 D:\WorkSpace\demo\target>java -jar demo-SNAPSHOT.jar demo-SNAPSHOT.jar中没有主清单属性…

flex布局中的几个小技巧

1. flex属性一定要写在父级元素的css属性&#xff0c;比如ul里面&#xff0c;不能写到li上面 ul{display:flex; // flex必须写在父元素ul里面justify-content:space-between;height:75px;li{height:75px;line-height:75px;flex:1;padding-left:23px;a{color:$colorB;fo…

3D数字孪生:从3D数据采集到3D内容分析

数字孪生&#xff08;Digital Twin&#xff09;是物理对象、流程或系统的虚拟复制品&#xff0c;用于监控、分析和优化现实世界的对应物。 这些数字孪生在制造、工程和城市规划等领域变得越来越重要&#xff0c;因为它们使我们能够在现实世界中实施改变之前模拟和测试不同的场景…

Linux操作(查询日志)

目录 前言 查看日志 cat less head tail 小结 前言 之前的linux文章属于入门linux,这篇文章主要是linux在后端开发人员中对日志的的运用.对于linux基础掌握不是很好的小伙伴可以先去看看linux基础操作:Linux系统使用(超详细)_linux操作系统使用_陌上 烟雨齐的博客-CSDN博…

Leetcode152. 连续子数组的最大乘积

力扣&#xff08;LeetCode&#xff09;官网 - 全球极客挚爱的技术成长平台 给你一个整数数组 nums &#xff0c;请你找出数组中乘积最大的非空连续子数组&#xff08;该子数组中至少包含一个数字&#xff09;&#xff0c;并返回该子数组所对应的乘积。 测试用例的答案是一个 32…

Android 系统中适配OAID获取

一、OAID概念 OAID&#xff08;Open Anonymous Identification&#xff09;是一种匿名身份识别标识符&#xff0c; 用于在移动设备上进行广告追踪和个性化广告投放。它是由中国移动通信集 团、中国电信集团和中国联通集团共同推出的一项行业标准 OAID值为一个64位的数字 二、…

【C语言】库宏offsetof

一.offsetof简介 因此,宏offsetof的作用是: 当你传入结构体的类型及其成员时,它会返回该成员在结构体中的偏移量. 二.offsetof的使用 如下,我们使用offsetof打印一下结构体foo中,成员a,成员b及成员c相对于首地址的偏移量分别是多少: #include <stdio.h> #include …

The specified module could not be found.

新电脑运行项目的时候出现了某个包找不到的问题 \\?\D:\guanwnag\cloudquery-website\node_modules\.pnpm\nxnx-win32-x64-msvc16.5.3\node_modules\nx\nx-win32-x64-msvc\nx.win32-x64-msvc.node 引入的路径就感觉有问题 去github上查找原因&#xff0c;发现是没安装 Micro…

代码随想录算法训练营day50|123.买卖股票的最佳时机III|188.买卖股票的最佳时机IV

123.买卖股票的最佳时机III 力扣题目链接 给定一个数组&#xff0c;它的第 i 个元素是一支给定的股票在第 i 天的价格。 设计一个算法来计算你所能获取的最大利润。你最多可以完成 两笔 交易。 注意&#xff1a;你不能同时参与多笔交易&#xff08;你必须在再次购买前出售掉…

Linux系统用户密码过期_禁用过期策略

检查用户密码过期信息 使用Chage命令可以检查用户密码更改策略和过期信息。要检查特定用户的密码过期信息&#xff0c;可以使用以下命令&#xff1a; chage -l 用户禁用用户的密码过期 chage -m 0 -M 99999 -I -1 -E -1 用户这个命令将禁用该用户的密码过期。其中&#xff0…