feat: 新增多个Redis相关的文章,更新Footer和Navbar组件,优化配置文件,修改搜索文本

This commit is contained in:
2025-07-19 18:20:30 +08:00
parent 995dbfcce6
commit 150bcef90e
29 changed files with 287 additions and 44 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -9,13 +9,33 @@ const currentYear = new Date().getFullYear();
<!--<div class="border-t border-[var(&#45;&#45;primary)] mx-16 border-dashed py-8 max-w-[var(&#45;&#45;page-width)] flex flex-col items-center justify-center px-6">--> <!--<div class="border-t border-[var(&#45;&#45;primary)] mx-16 border-dashed py-8 max-w-[var(&#45;&#45;page-width)] flex flex-col items-center justify-center px-6">-->
<div class="transition border-t border-black/10 dark:border-white/15 my-10 border-dashed mx-32"></div> <div class="transition border-t border-black/10 dark:border-white/15 my-10 border-dashed mx-32"></div>
<!--<div class="transition bg-[oklch(92%_0.01_var(&#45;&#45;hue))] dark:bg-black rounded-2xl py-8 mt-4 mb-8 flex flex-col items-center justify-center px-6">--> <!--<div class="transition bg-[oklch(92%_0.01_var(&#45;&#45;hue))] dark:bg-black rounded-2xl py-8 mt-4 mb-8 flex flex-col items-center justify-center px-6">-->
<div class="transition border-dashed border-[oklch(85%_0.01_var(--hue))] dark:border-white/15 rounded-2xl mb-12 flex flex-col items-center justify-center px-6"> <div class="transition border-dashed border-[oklch(85%_0.01_var(--hue))] dark:border-white/15 rounded-2xl mb-12 flex flex-col items-center justify-center px-6 py-6">
<div class="transition text-50 text-sm text-center"> <div class="transition text-50 text-sm text-center">
&copy; <span id="copyright-year">{currentYear}</span> {profileConfig.name}. All Rights Reserved. / <div class="mb-2">
<a class="transition link text-[var(--primary)] font-medium" target="_blank" href={url('rss.xml')}>RSS</a> / ✨ Made with 💝 by {profileConfig.name} ✨
<a class="transition link text-[var(--primary)] font-medium" target="_blank" href={url('sitemap-index.xml')}>Sitemap</a><br> </div>
Powered by <div class="mb-3">
<a class="transition link text-[var(--primary)] font-medium" target="_blank" href="https://astro.build">Astro</a> & © <span id="copyright-year">{currentYear}</span> All Rights Reserved 📝
<a class="transition link text-[var(--primary)] font-medium" target="_blank" href="https://github.com/saicaca/fuwari">Fuwari</a> </div>
<div class="flex flex-wrap items-center justify-center gap-2 text-xs">
<span>🔗</span>
<a class="transition link text-[var(--primary)] font-medium hover:scale-105" target="_blank" href={url('rss.xml')}>
📡 RSS
</a>
<span class="text-gray-400">•</span>
<a class="transition link text-[var(--primary)] font-medium hover:scale-105" target="_blank" href={url('sitemap-index.xml')}>
🗺️ Sitemap
</a>
</div>
<div class="mt-3 text-xs opacity-80">
🚀 Powered by
<a class="transition link text-[var(--primary)] font-medium hover:scale-105" target="_blank" href="https://astro.build">
⭐ Astro
</a>
&
<a class="transition link text-[var(--primary)] font-medium hover:scale-105" target="_blank" href="https://github.com/saicaca/fuwari">
<span class="inline-block animate-spin">🌸</span> Fuwari
</a>
</div>
</div> </div>
</div> </div>

View File

@@ -24,36 +24,36 @@ let links: NavBarLink[] = navBarConfig.links.map(
<div class="absolute h-8 left-0 right-0 -top-8 bg-[var(--card-bg)] transition"></div> <!-- used for onload animation --> <div class="absolute h-8 left-0 right-0 -top-8 bg-[var(--card-bg)] transition"></div> <!-- used for onload animation -->
<div class:list={[ <div class:list={[
className, className,
"card-base !overflow-visible max-w-[var(--page-width)] h-[4.5rem] !rounded-t-none mx-auto flex items-center justify-between px-4"]}> "card-base !overflow-visible max-w-[var(--page-width)] h-[4.5rem] !rounded-t-none mx-auto flex items-center justify-between px-6"]}>
<a href={url('/')} class="btn-plain scale-animation rounded-lg h-[3.25rem] px-5 font-bold active:scale-95"> <a href={url('/')} class="btn-plain scale-animation rounded-xl h-[3.25rem] px-6 font-bold active:scale-95 transition-all duration-200 hover:bg-[var(--primary)]/10">
<div class="flex flex-row text-[var(--primary)] items-center text-md"> <div class="flex flex-row text-[var(--primary)] items-center text-lg">
<Icon name="material-symbols:home-outline-rounded" class="text-[1.75rem] mb-1 mr-2" /> <Icon name="material-symbols:home-outline-rounded" class="text-[1.875rem] mr-3 transition-transform duration-200 hover:scale-110" />
{siteConfig.title} <span class="tracking-wide">{siteConfig.title}</span>
</div> </div>
</a> </a>
<div class="hidden md:flex"> <div class="hidden md:flex items-center space-x-2">
{links.map((l) => { {links.map((l) => {
return <a aria-label={l.name} href={l.external ? l.url : url(l.url)} target={l.external ? "_blank" : null} return <a aria-label={l.name} href={l.external ? l.url : url(l.url)} target={l.external ? "_blank" : null}
class="btn-plain scale-animation rounded-lg h-11 font-bold px-5 active:scale-95" class="btn-plain scale-animation rounded-xl h-11 font-medium px-5 active:scale-95 transition-all duration-200 hover:bg-[var(--primary)]/10 hover:text-[var(--primary)]"
> >
<div class="flex items-center"> <div class="flex items-center gap-2">
{l.name} <span class="tracking-wide">{l.name}</span>
{l.external && <Icon name="fa6-solid:arrow-up-right-from-square" class="text-[0.875rem] transition -translate-y-[1px] ml-1 text-black/[0.2] dark:text-white/[0.2]"></Icon>} {l.external && <Icon name="fa6-solid:arrow-up-right-from-square" class="text-[0.75rem] transition-all duration-200 opacity-60 hover:opacity-100"></Icon>}
</div> </div>
</a>; </a>;
})} })}
</div> </div>
<div class="flex"> <div class="flex items-center space-x-1">
<!--<SearchPanel client:load>--> <!--<SearchPanel client:load>-->
<Search client:only="svelte"></Search> <Search client:only="svelte"></Search>
{!siteConfig.themeColor.fixed && ( {!siteConfig.themeColor.fixed && (
<button aria-label="Display Settings" class="btn-plain scale-animation rounded-lg h-11 w-11 active:scale-90" id="display-settings-switch"> <button aria-label="Display Settings" class="btn-plain scale-animation rounded-xl h-11 w-11 active:scale-90 transition-all duration-200 hover:bg-[var(--primary)]/10" id="display-settings-switch">
<Icon name="material-symbols:palette-outline" class="text-[1.25rem]"></Icon> <Icon name="material-symbols:palette-outline" class="text-[1.25rem] transition-transform duration-200 hover:scale-110"></Icon>
</button> </button>
)} )}
<LightDarkSwitch client:only="svelte"></LightDarkSwitch> <LightDarkSwitch client:only="svelte"></LightDarkSwitch>
<button aria-label="Menu" name="Nav Menu" class="btn-plain scale-animation rounded-lg w-11 h-11 active:scale-90 md:!hidden" id="nav-menu-switch"> <button aria-label="Menu" name="Nav Menu" class="btn-plain scale-animation rounded-xl w-11 h-11 active:scale-90 md:!hidden transition-all duration-200 hover:bg-[var(--primary)]/10" id="nav-menu-switch">
<Icon name="material-symbols:menu-rounded" class="text-[1.25rem]"></Icon> <Icon name="material-symbols:menu-rounded" class="text-[1.25rem] transition-transform duration-200 hover:scale-110"></Icon>
</button> </button>
</div> </div>
<NavMenuPanel links={links}></NavMenuPanel> <NavMenuPanel links={links}></NavMenuPanel>

View File

@@ -43,42 +43,40 @@ export const navBarConfig: NavBarConfig = {
links: [ links: [
LinkPreset.Home, LinkPreset.Home,
LinkPreset.Archive, LinkPreset.Archive,
LinkPreset.About, LinkPreset.About
{
name: "GitHub",
url: "https://github.com/meowrain", // Internal links should not include the base path, as it is automatically added
external: true, // Show an external link icon and will open in a new tab
},
], ],
}; };
export const profileConfig: ProfileConfig = { export const profileConfig: ProfileConfig = {
avatar: "https://blog.meowrain.cn/api/i/2025/07/18/zn3t6t-1.webp", // Relative to the /src directory. Relative to the /public directory if it starts with '/' avatar: "https://blog.meowrain.cn/api/i/2025/07/18/zn3t6t-1.webp", // Relative to the /src directory. Relative to the /public directory if it starts with '/'
name: "MeowRain_Offical", name: "MeowRain",
bio: "A developer who loves to code and learn new things,build code for love❤ and fun🎉", bio: "A developer who loves to code and learn new things,build code for love❤ and fun🎉",
links: [ links: [
{
name: "Twitter",
icon: "fa6-brands:twitter", // Visit https://icones.js.org/ for icon codes
// You will need to install the corresponding icon set if it's not already included
// `pnpm add @iconify-json/<icon-set-name>`
url: "https://twitter.com",
},
{
name: "Steam",
icon: "fa6-brands:steam",
url: "https://store.steampowered.com",
},
{ {
name: "GitHub", name: "GitHub",
icon: "fa6-brands:github", icon: "fa6-brands:github",
url: "https://github.com/saicaca/fuwari", url: "https://github.com/meowrain",
}, },
{
name: "我的OpenWebUI站",
icon: "fa6-brands:airbnb",
url: "https://ai.meowrain.cn",
},
{
name: "服务器状态监控",
icon: "fa6-solid:server",
url: "https://status.meowrain.cn",
},
{
name: "bilibili",
icon: "fa6-brands:bilibili",
url: "https://space.bilibili.com/386388600",
}
], ],
}; };
export const licenseConfig: LicenseConfig = { export const licenseConfig: LicenseConfig = {
enable: true, enable: false,
name: "CC BY-NC-SA 4.0", name: "CC BY-NC-SA 4.0",
url: "https://creativecommons.org/licenses/by-nc-sa/4.0/", url: "https://creativecommons.org/licenses/by-nc-sa/4.0/",
}; };

View File

@@ -0,0 +1,18 @@
---
title: Redis为什么快
published: 2025-07-19
description: ''
image: 'https://blog.meowrain.cn/api/i/2025/07/19/p9zr81-1.webp'
tags: [Redis, 中间件]
category: '中间件 > Redis'
draft: false
lang: ''
---
# Redis为什么快
1. 使用内存存储
2. Redis采用了IO多路复用技术的事件驱动模型来处理客户端请求执行Redis命令
3. Redis6.0引入多线程机制把网络和I/O处理放到多个线程中减少了单线程的瓶颈网络IO交给线程池处理命令仍然在主线程中进行。充分利用CPU多核的优势提升了性能。
![](https://blog.meowrain.cn/api/i/2025/07/19/sbddqg-1.webp)
4. Redis 对底层数据结构做了极致的优化,比如说 String 的底层数据结构动态字符串支持动态扩容、预分配冗余空间,能够减少内存碎片和内存分配的开销。

View File

@@ -0,0 +1,102 @@
---
title: Redis有哪些数据类型
published: 2025-07-19
description: ''
image: 'https://blog.meowrain.cn/api/i/2025/07/19/p9zr81-1.webp'
tags: [Redis, 中间件, Redis数据类型]
category: '中间件 > Redis'
draft: false
lang: ''
---
# 官方文档
[Redis官方文档](https://redis.io/docs/latest/develop/data-types/)
![](https://blog.meowrain.cn/api/i/2025/07/19/pesc98-1.webp)
![JavaBetter](https://javabetter.cn/sidebar/sanfene/redis.html#_3-%F0%9F%8C%9Fredis%E6%9C%89%E5%93%AA%E4%BA%9B%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B)
# 基本数据类型
Redis支持五种基本数据类型
## 字符串
![](https://blog.meowrain.cn/api/i/2025/07/19/pfuo04-1.webp)
![Redis数据类型-字符串](https://redis.io/docs/latest/develop/data-types/#strings)
![详细文档](https://redis.io/docs/latest/develop/data-types/strings/)
字符串是最基本的数据类型可以存储文本数字或者二进制数据最大的容量是512MB。适合缓存单个对象比如验证码,token计数器等。
## 列表
![](https://blog.meowrain.cn/api/i/2025/07/19/phht75-1.webp)
![Redis数据类型-列表](https://redis.io/docs/latest/develop/data-types/#lists)
![详细文档](https://redis.io/docs/latest/develop/data-types/lists/)
列表是一个有序的字符串集合,可以在头部或尾部插入元素,适合用于消息队列,任务调度等场景。
## 哈希
![](https://blog.meowrain.cn/api/i/2025/07/19/pldpst-1.webp)
![Redis数据类型-哈希](https://redis.io/docs/latest/develop/data-types/#hashes)
![详细文档](https://redis.io/docs/latest/develop/data-types/hashes/)
哈希是一个键值对集合,适合用于存储对象。可以通过字段名快速访问字段值,支持对单个字段的操作,节省内存。
## 集合
![](https://blog.meowrain.cn/api/i/2025/07/19/plo11d-1.webp)
![Redis数据类型-集合](https://redis.io/docs/latest/develop/data-types/#sets)
![详细文档](https://redis.io/docs/latest/develop/data-types/sets/)
集合是一个无序的字符串集合,支持快速的成员查找,适合用于标签,好友关系等场景。
可以进行集合运算,如交集,差集,并集等。
平常拿来做一些去重操作。
## 有序集合
![](https://blog.meowrain.cn/api/i/2025/07/19/plwl0i-1.webp)
![Redis数据类型-有序集合](https://redis.io/docs/latest/develop/data-types/#sorted-sets)
![详细文档](https://redis.io/docs/latest/develop/data-types/sorted-sets/)
有序集合是一个有序的字符串集合,每个元素都有一个分数,支持根据分数进行范围查询,适合用于排行榜,消息队列等场景。
![](https://blog.meowrain.cn/api/i/2025/07/19/pmk3s0-1.webp)
![](https://blog.meowrain.cn/api/i/2025/07/19/pn3s6u-1.webp)
# 扩展数据类型
[redis3种特殊类型详解](https://pdai.tech/md/db/nosql-redis/db-redis-data-type-special.html#redis%E5%85%A5%E9%97%A8---%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B3%E7%A7%8D%E7%89%B9%E6%AE%8A%E7%B1%BB%E5%9E%8B%E8%AF%A6%E8%A7%A3)
## 位图bitmap
[详细文档](https://redis.io/docs/latest/develop/data-types/bitmaps/)
![](https://blog.meowrain.cn/api/i/2025/07/19/rfx8t3-1.webp)
位图是一个特殊的字符串类型,用于存储二进制位。可以用来统计用户活跃度,签到等场景。
## 基数统计HyperLogLog
[详细文档](https://redis.io/docs/latest/develop/data-types/probabilistic/hyperloglogs/)
![](https://blog.meowrain.cn/api/i/2025/07/19/rek2t9-1.webp)
![](https://blog.meowrain.cn/api/i/2025/07/19/repxn1-1.webp)
基数统计通常用于统计不重复的元素数量,比如网站访问量,用户注册量等。
## 地理位置Geo
存储地理信息
## Bloom Filter
[详细文档](https://redis.io/docs/latest/develop/data-types/probabilistic/bloom-filter/)

View File

@@ -0,0 +1,58 @@
---
title: 什么是Redis
published: 2025-07-19
description: ''
image: 'https://blog.meowrain.cn/api/i/2025/07/19/p9zr81-1.webp'
tags: [Redis, 中间件]
category: '中间件 > Redis'
draft: false
lang: ''
---
# 什么是Redis
Redis是一个开源的额高性能键值对存储系统它可以用作数据库、缓存和消息代理。Redis支持多种数据结构如字符串、哈希、列表、集合和有序集合等。
主要特点是把数据存放在内存中,相比于直接访问磁盘的关系型数据库,读写速度会更快。
## Redis的特点
1. **高性能**Redis可以每秒处理数百万个请求读写速度非常快。
2. **持久化**Redis支持将数据持久化到磁盘可以在重启后恢复数据。
3. **丰富的数据结构**:支持字符串、哈希、列表、集合、有序集合等多种数据类型,适用于不同的应用场景。
4. **原子操作**Redis支持对数据的原子操作保证数据的一致性。
5. **分布式**:支持主从复制、分片和高可用集群,适合大规模应用。
6. **发布/订阅**:支持发布/订阅模式,可以实现消息通知和实时数据更新。
7. **Lua脚本**支持Lua脚本可以在服务器端执行复杂的操作减少网络传输延迟。
8. **事务支持**:支持事务操作,可以保证一组命令要么全部执行成功,要么全部不执行。
9. **地理位置支持**:支持地理位置数据,可以进行地理位置查询和计算。
10. **多种客户端支持**提供多种编程语言的客户端库如Java、Python、Node.js等
11. **易于部署和使用**Redis的安装和配置相对简单社区活跃有丰富的文档和教程。
# 使用场景
Redis常用于以下场景
1. **缓存**:可以用来缓存数据库查询结果,减少数据库负载,提高
2. **会话存储**:可以用来存储用户会话信息,支持高并发访问。
3. **实时数据分析**:可以用来存储实时数据,如用户行为分析
4. **消息队列**:可以用作消息队列系统,支持发布/订阅模式。
5. **排行榜**:可以用来实现排行榜功能,支持有序集合数据结构。
6. **分布式锁**:可以用来实现分布式锁,支持高并发场景下的资源控制。
7. **地理位置服务**:可以用来存储地理位置信息,支持地理位置查询。
8. **计数器**:可以用来实现计数器功能,如网站访问量统计。
# Redis分布式部署的方式
Redis的分布式部署方式主要有以下几种
1. **主从复制Master-Slave Replication**:通过设置主节点和多个从节点,实现数据的复制和备份。主节点负责写操作,从节点负责读操作,可以提高读性能和数据安全性。
2. **分片Sharding**将数据分布到多个Redis实例中每个实例存储一部分数据。可以通过哈希算法将数据分配到不同的实例实现数据的水平扩展。常用的分片方式有一致性哈希Consistent Hashing和范围分片Range Sharding
3. **Redis集群Redis Cluster**Redis官方提供的集群模式支持自动分片和故障转移。Redis集群可以将数据分布到多个节点上每个节点存储一部分数据并且支持动态扩容和缩容。集群模式下客户端可以通过集群节点的地址直接访问数据无需额外的代理层。
4. **Sentinel模式**Redis Sentinel是Redis的高可用解决方案可以监控Redis实例的状态并在主节点发生故障时自动进行故障转移。Sentinel可以与主从复制结合使用提供高可用性和自动恢复能力。
# 和MySQL的区别
Redis不是关系型数据库而是一个键值对存储系统。
Redis把数据存放在内存中读写速度非常快而MySQL是基于磁盘的关系型数据库读写速度相对较慢。
实际开发中会把Redis作为缓存层存储一些热点数据减少对MySQL的访问压力提高系统性能。

View File

@@ -0,0 +1,47 @@
---
title: IO多路复用技术
published: 2025-07-19
description: ''
image: ''
tags: [IO,操作系统]
category: '操作系统'
draft: false
lang: ''
---
# 参考资料
![万字图解| 深入揭秘IO多路复用](https://cloud.tencent.com/developer/article/2383534)
# 为什么要有IO多路复用技术
在没有 I/O 多路复用(如 select/poll/epoll同步 I/O 确实主要分为以下两种模式:
![](https://blog.meowrain.cn/api/i/2025/07/19/squh53-1.webp)
![](https://blog.meowrain.cn/api/i/2025/07/19/sqxtqj-1.webp)
![](https://blog.meowrain.cn/api/i/2025/07/19/sqzp5w-1.webp)
当处理 大量并发连接 时,上述两种同步模型存在致命缺陷:
阻塞 I/O需要 1 线程/连接 → 线程切换开销大C10K 问题)
非阻塞 I/OCPU 空转轮询 → 资源浪费严重
![](https://blog.meowrain.cn/api/i/2025/07/19/srg062-1.webp)
![](https://blog.meowrain.cn/api/i/2025/07/19/srhn4e-1.webp)
# IO多路复用技术
IO多路复用是一种允许单个进程同时监视多个文件描述符的技术使得程序能高效处理多个并发连接而无需创建大量线程。
## **select/poll/epoll**
select 的缺点是单个进程能监视的文件描述符数量有限,一般为 1024 个,且每次调用都需要将文件描述符集合从用户态复制到内核态,然后遍历找出就绪的描述符,性能较差。
poll 的优点是没有最大文件描述符数量的限制,但是每次调用仍然需要将文件描述符集合从用户态复制到内核态,依然需要遍历,性能仍然较差。
epoll 是 Linux 特有的 IO 多路复用机制,支持大规模并发连接,使用事件驱动模型,性能更高。其工作原理是将文件描述符注册到内核中,然后通过事件通知机制来处理就绪的文件描述符,不需要轮询,也不需要数据拷贝,更没有数量限制,所以性能非常高。
epoll使用了事件驱动模型
![](https://blog.meowrain.cn/api/i/2025/07/19/u32dv8-1.webp)

View File

@@ -5,7 +5,7 @@ export const zh_CN: Translation = {
[Key.home]: "主页", [Key.home]: "主页",
[Key.about]: "关于", [Key.about]: "关于",
[Key.archive]: "归档", [Key.archive]: "归档",
[Key.search]: "搜索", [Key.search]: "Miku Beam!🌟",
[Key.tags]: "标签", [Key.tags]: "标签",
[Key.categories]: "分类", [Key.categories]: "分类",