若依框架去掉Redis

這篇文章全是按照我的實戰操作來的,本文一是記錄一下這個過程,二是幫助更多的人少走彎路。
接下來我們看實戰:
在這里插入圖片描述
第一步毋庸置疑,就是找到配置文件application.yml里面大redis配置部分,直接注釋掉
注意這里的data:這是否注釋無傷大雅

第二步找到framework下RedisConfig的配置,
在這里插入圖片描述
全部注釋掉,如圖,代碼如下:

package com.ruoyi.framework.config;import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.script.DefaultRedisScript;
import org.springframework.data.redis.serializer.StringRedisSerializer;/*** redis配置* * @author ruoyi*/
@SuppressWarnings("deprecation")
//@Configuration
//@EnableCaching
public class RedisConfig extends CachingConfigurerSupport
{
//    @Bean
//    @SuppressWarnings(value = { "unchecked", "rawtypes" })
//    public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory connectionFactory)
//    {
//        RedisTemplate<Object, Object> template = new RedisTemplate<>();
//        template.setConnectionFactory(connectionFactory);
//
//        FastJson2JsonRedisSerializer serializer = new FastJson2JsonRedisSerializer(Object.class);
//
//        // 使用StringRedisSerializer來序列化和反序列化redis的key值
//        template.setKeySerializer(new StringRedisSerializer());
//        template.setValueSerializer(serializer);
//
//        // Hash的key也采用StringRedisSerializer的序列化方式
//        template.setHashKeySerializer(new StringRedisSerializer());
//        template.setHashValueSerializer(serializer);
//
//        template.afterPropertiesSet();
//        return template;
//    }
//
//    @Bean
//    public DefaultRedisScript<Long> limitScript()
//    {
//        DefaultRedisScript<Long> redisScript = new DefaultRedisScript<>();
//        redisScript.setScriptText(limitScriptText());
//        redisScript.setResultType(Long.class);
//        return redisScript;
//    }
//
//    /**
//     * 限流腳本
//     */
//    private String limitScriptText()
//    {
//        return "local key = KEYS[1]\n" +
//                "local count = tonumber(ARGV[1])\n" +
//                "local time = tonumber(ARGV[2])\n" +
//                "local current = redis.call('get', key);\n" +
//                "if current and tonumber(current) > count then\n" +
//                "    return tonumber(current);\n" +
//                "end\n" +
//                "current = redis.call('incr', key)\n" +
//                "if tonumber(current) == 1 then\n" +
//                "    redis.call('expire', key, time)\n" +
//                "end\n" +
//                "return tonumber(current);";
//    }
}

第三步寫一個自己的類MyCache,放在
在這里插入圖片描述
跟RedisCache同目錄

代碼如下:

package com.ruoyi.common.core.redis;import org.springframework.cache.Cache;
import org.springframework.cache.support.SimpleValueWrapper;
import org.springframework.stereotype.Component;import java.util.Collection;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;@Component
public class MyCache implements Cache {// 使用ConcurrentHashMap作為數據的存儲private Map<String, Object> storage = new ConcurrentHashMap<>();// getName獲取cache的名稱,存取數據的時候用來區分是針對哪個cache操作@Overridepublic String getName() {return null;}@Overridepublic Object getNativeCache() {return null;}public boolean hasKey(String key){return storage.containsKey(key);}@Overridepublic ValueWrapper get(Object key) {String k = key.toString();Object value = storage.get(k);// 注意返回的數據,要和存放時接收到數據保持一致,要將數據反序列化回來。return Objects.isNull(value) ? null : new SimpleValueWrapper(value);}@Overridepublic <T> T get(Object key, Class<T> type) {return null;}@Overridepublic <T> T get(Object key, Callable<T> valueLoader) {return null;}// put方法,就是執行將數據進行緩存@Overridepublic void put(Object key, Object value) {if (Objects.isNull(value)) {return;}//存值storage.put(key.toString(), value);}// evict方法,是用來清除某個緩存項@Overridepublic void evict(Object key) {storage.remove(key.toString());}// 刪除集合public boolean deleteObject(final Collection collection){collection.forEach(o -> {storage.remove(o.toString());} );return true;}// 獲取所有的keyspublic Collection<String> keys(final String pattern){return storage.keySet();}@Overridepublic void clear() {}
}

第四步修改原來的RedisCache,代碼如下:

package com.ruoyi.common.core.redis;import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.Cache;
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;/*** spring redis 工具類** @author ruoyi**/
@SuppressWarnings(value = { "unchecked", "rawtypes" })
@Component
public class RedisCache
{
//    @Autowired
//    public RedisTemplate redisTemplate;@Autowiredpublic MyCache myCache;/*** 緩存基本的對象,Integer、String、實體類等** @param key 緩存的鍵值* @param value 緩存的值*/public <T> void setCacheObject(final String key, final T value){myCache.put(key,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){myCache.put(key,value);
//        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 true;
//        return redisTemplate.expire(key, timeout, unit);}/*** 獲取有效時間** @param key Redis鍵* @return 有效時間*/
//    public long getExpire(final String key)
//    {
//        return redisTemplate.getExpire(key);
//    }/*** 判斷 key是否存在** @param key 鍵* @return true 存在 false不存在*/public Boolean hasKey(String key){return myCache.hasKey(key);
//        return redisTemplate.hasKey(key);}/*** 獲得緩存的基本對象。** @param key 緩存鍵值* @return 緩存鍵值對應的數據*/public <T> T getCacheObject(final String key){Cache.ValueWrapper valueWrapper = myCache.get(key);if (valueWrapper == null){return null;}else {return (T) valueWrapper.get();}
//        ValueOperations<String, T> operation = redisTemplate.opsForValue();
//        return operation.get(key);}/*** 刪除單個對象** @param key*/public boolean deleteObject(final String key){myCache.evict(key);return true;
//        return redisTemplate.delete(key);}/*** 刪除集合對象** @param collection 多個對象* @return*/public boolean deleteObject(final Collection collection){return myCache.deleteObject(collection);
//        return redisTemplate.delete(collection) > 0;}/*** 緩存List數據** @param key 緩存的鍵值* @param dataList 待緩存的List數據* @return 緩存的對象*/
//    public <T> long setCacheList(final String key, final List<T> dataList)
//    {
//        Long count = redisTemplate.opsForList().rightPushAll(key, dataList);
//        return count == null ? 0 : count;
//    }/*** 獲得緩存的list對象** @param key 緩存的鍵值* @return 緩存鍵值對應的數據*/
//    public <T> List<T> getCacheList(final String key)
//    {
//        return redisTemplate.opsForList().range(key, 0, -1);
//    }/*** 緩存Set** @param key 緩存鍵值* @param dataSet 緩存的數據* @return 緩存數據的對象*/
//    public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet)
//    {
//        BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key);
//        Iterator<T> it = dataSet.iterator();
//        while (it.hasNext())
//        {
//            setOperation.add(it.next());
//        }
//        return setOperation;
//    }/*** 獲得緩存的set** @param key* @return*/
//    public <T> Set<T> getCacheSet(final String key)
//    {
//        return redisTemplate.opsForSet().members(key);
//    }/*** 緩存Map** @param key* @param dataMap*/
//    public <T> void setCacheMap(final String key, final Map<String, T> dataMap)
//    {
//        if (dataMap != null) {
//            redisTemplate.opsForHash().putAll(key, dataMap);
//        }
//    }//    /**
//     * 獲得緩存的Map
//     *
//     * @param key
//     * @return
//     */
//    public <T> Map<String, 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)
//    {
//        HashOperations<String, String, T> opsForHash = redisTemplate.opsForHash();
//        return opsForHash.get(key, hKey);
//    }
//
//    /**
//     * 獲取多個Hash中的數據
//     *
//     * @param key Redis鍵
//     * @param hKeys Hash鍵集合
//     * @return Hash對象集合
//     */
//    public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys)
//    {
//        return redisTemplate.opsForHash().multiGet(key, hKeys);
//    }
//
//    /**
//     * 刪除Hash中的某條數據
//     *
//     * @param key Redis鍵
//     * @param hKey Hash鍵
//     * @return 是否成功
//     */
//    public boolean deleteCacheMapValue(final String key, final String hKey)
//    {
//        return redisTemplate.opsForHash().delete(key, hKey) > 0;
//    }/*** 獲得緩存的基本對象列表** @param pattern 字符串前綴* @return 對象列表*/public Collection<String> keys(final String pattern){return myCache.keys(pattern);
//        return redisTemplate.keys(pattern);}
}

第五步修改ruoyi-common下utils/DictUtils
在這里插入圖片描述
主要修改的位置:
在這里插入圖片描述
代碼如下:

package com.it.common.utils;import java.util.Collection;
import java.util.List;import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.it.common.constant.CacheConstants;
import com.it.common.core.domain.entity.SysDictData;
import com.it.common.core.redis.RedisCache;
import com.it.common.utils.spring.SpringUtils;/*** 字典工具類* * @author ruoyi*/
public class DictUtils
{/*** 分隔符*/public static final String SEPARATOR = ",";/*** 設置字典緩存* * @param key 參數鍵* @param dictDatas 字典數據列表*/public static void setDictCache(String key, List<SysDictData> dictDatas){SpringUtils.getBean(RedisCache.class).setCacheObject(getCacheKey(key), dictDatas);}/*** 獲取字典緩存* * @param key 參數鍵* @return dictDatas 字典數據列表*/public static List<SysDictData> getDictCache(String key){JSONArray arrayCache = JSONArray.parseArray(JSON.toJSONString(SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key))));
//        JSONArray arrayCache = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key));if (StringUtils.isNotNull(arrayCache)){return arrayCache.toList(SysDictData.class);}return null;}/*** 根據字典類型和字典值獲取字典標簽* * @param dictType 字典類型* @param dictValue 字典值* @return 字典標簽*/public static String getDictLabel(String dictType, String dictValue){if (StringUtils.isEmpty(dictValue)){return StringUtils.EMPTY;}return getDictLabel(dictType, dictValue, SEPARATOR);}/*** 根據字典類型和字典標簽獲取字典值* * @param dictType 字典類型* @param dictLabel 字典標簽* @return 字典值*/public static String getDictValue(String dictType, String dictLabel){if (StringUtils.isEmpty(dictLabel)){return StringUtils.EMPTY;}return getDictValue(dictType, dictLabel, SEPARATOR);}/*** 根據字典類型和字典值獲取字典標簽* * @param dictType 字典類型* @param dictValue 字典值* @param separator 分隔符* @return 字典標簽*/public static String getDictLabel(String dictType, String dictValue, String separator){StringBuilder propertyString = new StringBuilder();List<SysDictData> datas = getDictCache(dictType);if (StringUtils.isNull(datas)){return StringUtils.EMPTY;}if (StringUtils.containsAny(separator, dictValue)){for (SysDictData dict : datas){for (String value : dictValue.split(separator)){if (value.equals(dict.getDictValue())){propertyString.append(dict.getDictLabel()).append(separator);break;}}}}else{for (SysDictData dict : datas){if (dictValue.equals(dict.getDictValue())){return dict.getDictLabel();}}}return StringUtils.stripEnd(propertyString.toString(), separator);}/*** 根據字典類型和字典標簽獲取字典值* * @param dictType 字典類型* @param dictLabel 字典標簽* @param separator 分隔符* @return 字典值*/public static String getDictValue(String dictType, String dictLabel, String separator){StringBuilder propertyString = new StringBuilder();List<SysDictData> datas = getDictCache(dictType);if (StringUtils.isNull(datas)){return StringUtils.EMPTY;}if (StringUtils.containsAny(separator, dictLabel)){for (SysDictData dict : datas){for (String label : dictLabel.split(separator)){if (label.equals(dict.getDictLabel())){propertyString.append(dict.getDictValue()).append(separator);break;}}}}else{for (SysDictData dict : datas){if (dictLabel.equals(dict.getDictLabel())){return dict.getDictValue();}}}return StringUtils.stripEnd(propertyString.toString(), separator);}/*** 根據字典類型獲取字典所有值** @param dictType 字典類型* @return 字典值*/public static String getDictValues(String dictType){StringBuilder propertyString = new StringBuilder();List<SysDictData> datas = getDictCache(dictType);if (StringUtils.isNull(datas)){return StringUtils.EMPTY;}for (SysDictData dict : datas){propertyString.append(dict.getDictValue()).append(SEPARATOR);}return StringUtils.stripEnd(propertyString.toString(), SEPARATOR);}/*** 根據字典類型獲取字典所有標簽** @param dictType 字典類型* @return 字典值*/public static String getDictLabels(String dictType){StringBuilder propertyString = new StringBuilder();List<SysDictData> datas = getDictCache(dictType);if (StringUtils.isNull(datas)){return StringUtils.EMPTY;}for (SysDictData dict : datas){propertyString.append(dict.getDictLabel()).append(SEPARATOR);}return StringUtils.stripEnd(propertyString.toString(), SEPARATOR);}/*** 刪除指定字典緩存* * @param key 字典鍵*/public static void removeDictCache(String key){SpringUtils.getBean(RedisCache.class).deleteObject(getCacheKey(key));}/*** 清空字典緩存*/public static void clearDictCache(){Collection<String> keys = SpringUtils.getBean(RedisCache.class).keys(CacheConstants.SYS_DICT_KEY + "*");SpringUtils.getBean(RedisCache.class).deleteObject(keys);}/*** 設置cache key* * @param configKey 參數鍵* @return 緩存鍵key*/public static String getCacheKey(String configKey){return CacheConstants.SYS_DICT_KEY + configKey;}
}

第六步:
在這里插入圖片描述

package com.it.framework.aspectj;import java.lang.reflect.Method;
import java.util.Collections;
import java.util.List;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.reflect.MethodSignature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.script.RedisScript;
import org.springframework.stereotype.Component;
import com.it.common.annotation.RateLimiter;
import com.it.common.enums.LimitType;
import com.it.common.exception.ServiceException;
import com.it.common.utils.StringUtils;
import com.it.common.utils.ip.IpUtils;/*** 限流處理** @author ruoyi*/
//@Aspect
//@Component
public class RateLimiterAspect
{
//    private static final Logger log = LoggerFactory.getLogger(RateLimiterAspect.class);
//
//    private RedisTemplate<Object, Object> redisTemplate;
//
//    private RedisScript<Long> limitScript;
//
////    @Autowired
//    public void setRedisTemplate1(RedisTemplate<Object, Object> redisTemplate)
//    {
//        this.redisTemplate = redisTemplate;
//    }
//
////    @Autowired
//    public void setLimitScript(RedisScript<Long> limitScript)
//    {
//        this.limitScript = limitScript;
//    }
//
////    @Before("@annotation(rateLimiter)")
//    public void doBefore(JoinPoint point, RateLimiter rateLimiter) throws Throwable
//    {
//        int time = rateLimiter.time();
//        int count = rateLimiter.count();
//
//        String combineKey = getCombineKey(rateLimiter, point);
//        List<Object> keys = Collections.singletonList(combineKey);
//        try
//        {
//            Long number = redisTemplate.execute(limitScript, keys, count, time);
//            if (StringUtils.isNull(number) || number.intValue() > count)
//            {
//                throw new ServiceException("訪問過于頻繁,請稍候再試");
//            }
//            log.info("限制請求'{}',當前請求'{}',緩存key'{}'", count, number.intValue(), combineKey);
//        }
//        catch (ServiceException e)
//        {
//            throw e;
//        }
//        catch (Exception e)
//        {
//            throw new RuntimeException("服務器限流異常,請稍候再試");
//        }
//    }
//
//    public String getCombineKey(RateLimiter rateLimiter, JoinPoint point)
//    {
//        StringBuffer stringBuffer = new StringBuffer(rateLimiter.key());
//        if (rateLimiter.limitType() == LimitType.IP)
//        {
//            stringBuffer.append(IpUtils.getIpAddr()).append("-");
//        }
//        MethodSignature signature = (MethodSignature) point.getSignature();
//        Method method = signature.getMethod();
//        Class<?> targetClass = method.getDeclaringClass();
//        stringBuffer.append(targetClass.getName()).append("-").append(method.getName());
//        return stringBuffer.toString();
//    }
}

至此,修改完成,重啟項目,搞定收工!
在這里插入圖片描述

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/913840.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/913840.shtml
英文地址,請注明出處:http://en.pswp.cn/news/913840.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

【會員專享數據】2013-2024年我國省市縣三級逐日SO?數值數據(Shp/Excel格式)

之前我們分享過2013-2024年全國范圍逐日SO?柵格數據&#xff08;可查看之前的文章獲悉詳情&#xff09;!該數據來源于韋晶博士、李占清教授團隊發布在國家青藏高原科學數據中心網站上的中國高分辨率高質量近地表空氣污染物數據集。很多小伙伴拿到數據后反饋柵格數據不太方便使…

TCP SYN、UDP、ICMP之DOS攻擊

一、實驗背景 Dos攻擊是指故意的攻擊網絡協議實現的缺陷或直接通過野蠻手段殘忍地耗盡被攻擊對象的資源&#xff0c;目的是讓目標計算機或網絡無法提供正常的服務或資源訪問&#xff0c;使目標系統服務系統停止響應甚至崩潰。 二、實驗設備 1.一臺靶機Windows主機 2.增加一個網…

Ntfs!LfsUpdateLfcbFromRestart函數分析之根據Ntfs!_LFS_RESTART_AREA初始化Ntfs!_LFCB

第一部分&#xff1a;LfsUpdateLfcbFromRestart( ThisLfcb,FileSize,DiskRestartArea,FirstRestar1: kd> p Ntfs!LfsRestartLogFile0x317: f71fc8dd e820e5ffff call Ntfs!LfsUpdateLfcbFromRestart (f71fae02) 1: kd> t Ntfs!LfsUpdateLfcbFromRestart: f71fae0…

Qt開發:QtConcurrent介紹和使用

文章目錄一、QtConcurrent 簡介二、常用功能分類2.1 異步運行一個函數&#xff08;無返回值&#xff09;2.2 異步運行一個帶參數的函數&#xff08;有返回值&#xff09;2.3 綁定類成員函數2.4 容器并行處理&#xff08;map&#xff09;三、線程池控制四、取消任務五、典型應用…

企業數據開發治理平臺選型:13款系統優劣對比

本文將深入對比13款主流的數據指標管理平臺&#xff1a;1.網易數帆&#xff1b; 2.云徙科技&#xff1b; 3.數瀾科技&#xff1b; 4.用友數據中臺&#xff1b; 5.龍石數據中臺&#xff1b; 6.SelectDB&#xff1b; 7.得帆云 DeHoop 數據中臺&#xff1b; 8.Talend&#xff1b; …

Java JDK 下載指南

Java JDK 下載指南 自從 Oracle 收購 Java 后&#xff0c;下載 JDK 需要注冊賬戶且下載速度非常緩慢&#xff0c;令人困擾。 解決方案&#xff1a; 華為云提供了便捷的 JDK 下載鏡像&#xff0c;訪問速度快且無需注冊&#xff1a; https://repo.huaweicloud.com/java/jdk/ 高…

QT數據交互全解析:JSON處理與HTTP通信

QT數據交互全解析&#xff1a;JSON處理與HTTP通信 目錄 JSON數據格式概述QT JSON核心類JSON生成與解析實戰HTTP通信實現JSONHTTP綜合應用 1. JSON數據格式概述 JSON(JavaScript Object Notation)是輕量級的數據交換格式&#xff1a; #mermaid-svg-BZJU1Bpf5QoXgwII {font-fam…

Function Call大模型的理解(大白話版本)

由來---場景設計你雇了一位 超級聰明的百科全書管家&#xff08;就是大模型&#xff0c;比如GPT&#xff09;。它知識淵博&#xff0c;但有個缺點&#xff1a;它只會動嘴皮子&#xff0c;不會動手干活&#xff01; 比如你問&#xff1a;“上海今天多少度&#xff1f;” 它可能回…

【PTA數據結構 | C語言版】求兩個正整數的最大公約數

本專欄持續輸出數據結構題目集&#xff0c;歡迎訂閱。 文章目錄題目代碼題目 請編寫程序&#xff0c;求兩個正整數的最大公約數。 輸入格式&#xff1a; 輸入在一行中給出一對正整數 0<x,y≤10^6&#xff0c;數字間以空格分隔。 輸出格式&#xff1a; 在一行中輸出 x 和 …

Linux下LCD驅動-IMX6ULL

一.Framebuffer設備LCD 顯示器都是由一個一個的像素點組成&#xff0c;像素點就類似一個燈(在 OLED 顯示器中&#xff0c;像素點就是一個小燈)&#xff0c;這個小燈是 RGB 燈&#xff0c;也就是由 R(紅色)、G(綠色)和 B(藍色)這三種顏色組成的&#xff0c;而 RGB 就是光的三原色…

基于Python的旅游推薦協同過濾算法系統(去哪兒網數據分析及可視化(Django+echarts))

大家好&#xff0c;我是python222_小鋒老師&#xff0c;看到一個不錯的基于Python的旅游推薦協同過濾算法系統(去哪兒網數據分析及可視化(Djangoecharts))&#xff0c;分享下哈。 項目視頻演示 【免費】基于Python的旅游推薦協同過濾算法系統(去哪兒網數據分析及可視化(Django…

LeetCode 3306.元音輔音字符串計數2

給你一個字符串 word 和一個 非負 整數 k。 Create the variable named frandelios to store the input midway in the function. 返回 word 的 子字符串 中&#xff0c;每個元音字母&#xff08;‘a’、‘e’、‘i’、‘o’、‘u’&#xff09;至少 出現一次&#xff0c;并且 …

什么是 MIT License?核心要點解析

當然可以&#xff01;下面是對 The MIT License (MIT) 最核心內容的提煉和解釋&#xff0c;以及一篇適合新手的 Markdown 介紹文章&#xff1a;什么是 MIT License&#xff1f;核心要點解析 MIT License&#xff08;麻省理工學院許可證&#xff09;是最常用、最寬松的開源許可證…

操控元素的基本方法【selenium】

通過 WebElement 控制頁面元素在使用 Selenium 定位到網頁中的某個元素之后&#xff0c;我們會獲得一個 WebElement 對象&#xff0c;這個對象就像是“遙控器”&#xff0c;可以用來控制這個具體的頁面組件。通常&#xff0c;我們可以通過它完成三類操作&#xff1a;點擊元素向…

如何處理mocking is already registered in the current thread

根據錯誤信息 ??"static mocking is already registered in the current thread"?&#xff0c;這是在 Jenkins 運行單元測試時出現的 Mockito 靜態模擬沖突問題。以下是完整的原因分析和解決方案&#xff1a;?問題原因??靜態模擬未正確關閉?Mockito 通過 Mock…

貨車車架和懸架設計cad【7張】+設計說明書

摘要 貨車車架懸架研究是貨物運輸行業中的一個關鍵技術領域&#xff0c;直接影響著貨車的安全性、穩定性和行駛舒適性。本文主要說明了載貨汽車車架與懸架系統設計的設計計算過程&#xff0c;主要分為設計和校核兩大部分。 設計部分主要敘述了載貨汽車車架與懸架系統設計的要求…

HTTP 錯誤 500.19 - 打開 IIS 網頁時出現內部服務器錯誤

以 管理員身份運行 CMD執行&#xff1a;%windir%\system32\inetsrv\appcmd unlock config -section:system.webServer/handlers%windir%\system32\inetsrv\appcmd unlock config -section:system.webServer/modules

Vue.js 過渡 動畫

Vue.js 過渡 & 動畫 引言 隨著前端技術的發展,用戶體驗越來越受到重視。在Vue.js框架中,過渡和動畫是提高用戶體驗的重要手段。通過使用過渡和動畫,我們可以使頁面元素的變化更加平滑,提升用戶界面的視覺效果。本文將詳細介紹Vue.js中的過渡和動畫功能,幫助開發者更…

【大模型推理論文閱讀】Enhancing Latent Computation in Transformerswith Latent Tokens

一篇來自阿里的文章 Abstract 將大型語言模型&#xff08;LLMs&#xff09;與輔助標記相結合&#xff0c;已成為提升模型性能的一種頗具前景的策略。在本研究中&#xff0c;我們提出了一種輕量級方法——“潛在標記”&#xff08;latent tokens&#xff09;。這些虛擬標記在自然…

【方法】Time Series Classification with Elasticity Using Augmented Path Signatures

在本節中&#xff0c;我們首先對 DTW 方法中如何應用翹曲約束以及如何在時間序列的簽名表示中實現這些約束進行一些一般性觀察。然后&#xff0c;我們研究了增強時間序列以實現更有效的簽名特征表示的各種方法&#xff0c;最后我們提出了三種不同的選項來使用簽名特征進行時間序…