Redis、KV、MySQL 存储对比

从架构、性能、使用场景等维度对比 Redis、KV 存储与 MySQL 的选型。

杂项笔记
ow.addEventListener('DOMContentLoaded', (event) => { ctx.services = Object.assign({}, JSON.parse(`{"mdrender":{"js":"/js/services/mdrender.js"},"siteinfo":{"js":"/js/services/siteinfo.js","api":null},"ghinfo":{"js":"/js/services/ghinfo.js"},"sites":{"js":"/js/services/sites.js"},"friends":{"js":"/js/services/friends.js"},"friends_and_posts":{"js":"/js/services/friends_and_posts.js"},"timeline":{"js":"/js/services/timeline.js"},"fcircle":{"js":"/js/services/fcircle.js"},"weibo":{"js":"/js/services/weibo.js"},"memos":{"js":"/js/services/memos.js"},"voice":{"js":"/js/plugins/voice.js"},"video":{"js":"/js/plugins/video.js"},"download-file":{"js":"/js/plugins/download-file.js"},"twikoo":{"js":"/js/services/twikoo_latest_comment.js"},"waline":{"js":"/js/services/waline_latest_comment.js"},"artalk":{"js":"/js/services/artalk_latest_comment.js"},"giscus":{"js":"/js/services/giscus_latest_comment.js"}}`)); for (let id of Object.keys(ctx.services)) { const js = ctx.services[id].js; if (id == 'siteinfo') { ctx.cardlinks = document.querySelectorAll('a.link-card[cardlink]'); if (ctx.cardlinks?.length > 0) { utils.js(js, { defer: true }).then(function () { setCardLink(ctx.cardlinks); }); } } else if (id == 'voice') { ctx.voiceAudios = document.querySelectorAll('.voice>audio'); if (ctx.voiceAudios?.length > 0) { utils.js(js, { defer: true }).then(function () { createVoiceDom(ctx.voiceAudios); }); } } else if (id == 'video') { ctx.videos = document.querySelectorAll('.video>video'); if (ctx.videos?.length > 0) { utils.js(js, { defer: true }).then(function () { videoEvents(ctx.videos); }); } } else if (id == 'download-file') { ctx.files = document.querySelectorAll('.file'); if (ctx.files?.length > 0) { utils.js(js, { defer: true }).then(function () { downloadFileEvent(ctx.files); }); } } else { const els = document.getElementsByClassName(`ds-${id}`); if (els?.length > 0) { utils.jq(() => { if (id == 'timeline' || 'memos' || 'marked') { utils.js(deps.marked).then(function () { utils.js(js, { defer: true }); }); } else { utils.js(js, { defer: true }); } }); } } } // chat iphone time let phoneTimes = document.querySelectorAll('.chat .status-bar .time'); if (phoneTimes.length > 0) { NowTime(); var date = new Date(); var sec = date.getSeconds(); var firstAdjustInterval = setInterval(firstAdjustTime, 1000 * (60 - sec)); } function firstAdjustTime() { NowTime(); clearInterval(firstAdjustInterval); setInterval(NowTime, 1000 * 60); } function NowTime() { for (let i = 0; i < phoneTimes.length; ++i) { var timeSpan = phoneTimes[i]; var date = new Date(); var hour = date.getHours(); var min = date.getMinutes(); timeSpan.innerHTML = check(hour) + ":" + check(min); } }; function check(val) { if (val < 10) { return ("0" + val); } return (val); } // chat quote const chat_quote_obverser = new IntersectionObserver((entries, observer) => { entries.filter((entry) => { return entry.isIntersecting }).sort((a, b) => a.intersectionRect.y !== b.intersectionRect.y ? a.intersectionRect.y - b.intersectionRect.y : a.intersectionRect.x - b.intersectionRect.x).forEach((entry, index) => { observer.unobserve(entry.target); setTimeout(() => { entry.target.classList.add('quote-blink'); setTimeout(() => { entry.target.classList.remove('quote-blink'); }, 1000); }, Math.max(100, 16) * (index + 1)); }); }); var chatQuotes = document.querySelectorAll(".chat .talk .quote"); chatQuotes.forEach((quote) => { quote.addEventListener('click', function () { var chatCellDom = document.getElementById("quote-" + quote.getAttribute("quotedCellTag")); if (chatCellDom) { var chatDiv = chatCellDom.parentElement; var mid = chatDiv.clientHeight / 2; var offsetTop = chatCellDom.offsetTop; if (offsetTop > mid - chatCellDom.clientHeight / 2) { chatDiv.scrollTo({ top: chatCellDom.offsetTop - mid + chatCellDom.clientHeight / 2, behavior: "smooth" }); } else { chatDiv.scrollTo({ top: 0, behavior: "smooth" }); } chat_quote_obverser.observe(chatCellDom); } }); }); });