ๆƒฏๆ€ง่šๅˆ ้ซ˜ๆ•ˆ่ฟฝ่ธชๅ’Œ้˜…่ฏปไฝ ๆ„Ÿๅ…ด่ถฃ็š„ๅšๅฎขใ€ๆ–ฐ้—ปใ€็ง‘ๆŠ€่ต„่ฎฏ
้˜…่ฏปๅŽŸๆ–‡ ๅœจๆƒฏๆ€ง่šๅˆไธญๆ‰“ๅผ€

ๆŽจ่่ฎข้˜…ๆบ

T
Tenable Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Google Online Security Blog
Google Online Security Blog
T
Threat Research - Cisco Blogs
D
Darknet โ€“ Hacking Tools, Hacker News & Cyber Security
W
WeLiveSecurity
NISL@THU
NISL@THU
V
Vulnerabilities โ€“ Threatpost
V2EX - ๆŠ€ๆœฏ
V2EX - ๆŠ€ๆœฏ
Cisco Talos Blog
Cisco Talos Blog
Simon Willison's Weblog
Simon Willison's Weblog
The Last Watchdog
The Last Watchdog
P
Privacy International News Feed
ๅš
ๅšๅฎขๅ›ญ - ไธ‰็”Ÿ็ŸณไธŠ(FineUIๆŽงไปถ)
Recent Announcements
Recent Announcements
้…ท ๅฃณ โ€“ CoolShell
้…ท ๅฃณ โ€“ CoolShell
็พŽ
็พŽๅ›ขๆŠ€ๆœฏๅ›ข้˜Ÿ
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Scott Helme
Scott Helme
C
Cybersecurity and Infrastructure Security Agency CISA
Cyberwarzone
Cyberwarzone
้‡
้‡ๅญไฝ
Security Archives - TechRepublic
Security Archives - TechRepublic
Microsoft Azure Blog
Microsoft Azure Blog
F
Fortinet All Blogs
H
Hacker News: Front Page
D
Docker
N
Netflix TechBlog - Medium
้˜ฎไธ€ๅณฐ็š„็ฝ‘็ปœๆ—ฅๅฟ—
้˜ฎไธ€ๅณฐ็š„็ฝ‘็ปœๆ—ฅๅฟ—
G
Google Developers Blog
Hugging Face - Blog
Hugging Face - Blog
่…พ
่…พ่ฎฏCDC
Last Week in AI
Last Week in AI
H
Hackread โ€“ Cybersecurity News, Data Breaches, AI and More
K
Kaspersky official blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
่ฎฉๅฐไบงๅ“็š„็‹ฌ็ซ‹ๅ˜็Žฐๆ›ด็ฎ€ๅ• - ezindie.com
่ฎฉๅฐไบงๅ“็š„็‹ฌ็ซ‹ๅ˜็Žฐๆ›ด็ฎ€ๅ• - ezindie.com
็ˆฑ่Œƒๅ„ฟ
็ˆฑ่Œƒๅ„ฟ
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
ๅฐไผ—่ฝฏไปถ
ๅฐไผ—่ฝฏไปถ
S
Security Affairs
ๅš
ๅšๅฎขๅ›ญ - ่‚ๅพฎไธœ
AI
AI
Latest news
Latest news
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Engineering at Meta
Engineering at Meta
Cloudbric
Cloudbric
S
Secure Thoughts
Spread Privacy
Spread Privacy
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Donโ€™t Fail โ€” They Drift Spilling beans for how i learn for exam๐Ÿ˜"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" โ€” What Actually Happened Comfy Cloudโ€™s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions โ€” here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components โ€” Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cรณmo construรญ un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 ๐Ÿš€ I Built an Ethical Hacking Scanner Tool โ€“ Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points โ€” Here's What I Found About How Markets Really Move EcoTrack AI โ€” Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead โ€” I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve โ€” no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like Youโ€™re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace โ€” how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025โ€“62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D โ€” A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent โ€” It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly โ€” 2026/04/10โ€“04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI ้€ฑๅ ฑ โ€” 2026/04/10โ€“2026/04/17 ๆจกๅž‹ๅฐ้Ž–ๆฝฎไพ†ไบ†๏ผŒไฝ†ๅทฅๅ…ท้ˆๆ‰ๆ˜ฏ็œŸๆˆฐๅ ด Maybe this is how Open-Source apps are born... ๐Ÿš€ Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge โ€” $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase โ€” Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train โ€” Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extraรงรฃo de Vรญdeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life โ€” Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 โ€” Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows โ€” Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTrackingๅฎ‰่ฃ…ๅ’ŒiPhone้ขๆ•้…็ฝฎๆ•™็จ‹๏ผŒๆœ‰bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
๐—–๐—ฎ๐—ฐ๐—ต๐—ถ๐—ป๐—ด ๐—ฆ๐˜๐—ฟ๐—ฎ๐˜๐—ฒ๐—ด๐—ถ๐—ฒ๐˜€ ๐—˜๐˜…๐—ฝ๐—น๐—ฎ๐—ถ๐—ป๐—ฒ๐—ฑ (Backend & Frontend Developers)
Kiran ยท 2026-05-27 ยท via DEV Community

An interviewer asked: "What caching strategy does your app use?"
The candidate said: "We use Redis."
Interviewer: "That's a tool. I asked for a strategy."
Silence. Interview over. ๐Ÿ˜ถ

Here's every caching strategy broken down ๐Ÿ‘‡


๐Ÿง  ๐—ช๐—ต๐—ฎ๐˜ ๐—ถ๐˜€ ๐—–๐—ฎ๐—ฐ๐—ต๐—ถ๐—ป๐—ด?

๐Ÿ‘‰ Storing data temporarily so future requests are served faster
๐Ÿ‘‰ Avoids hitting the original source โ€” DB, API, server โ€” every time
๐Ÿ‘‰ Wrong strategy = stale data, crashes, data loss

Without cache: User โ†’ Server โ†’ Database (slow ๐Ÿข)
With cache:    User โ†’ Cache (fast โšก)
                        โ†“ miss only
                      Database

Enter fullscreen mode Exit fullscreen mode

โœ” Reduces latency
โœ” Reduces database load
โœ” Scales better under traffic


โšก 1๏ธโƒฃ ๐—–๐—ฎ๐—ฐ๐—ต๐—ฒ-๐—”๐˜€๐—ถ๐—ฑ๐—ฒ (๐—Ÿ๐—ฎ๐˜‡๐˜† ๐—Ÿ๐—ผ๐—ฎ๐—ฑ๐—ถ๐—ป๐—ด)

๐Ÿ‘‰ App checks cache first. Miss โ†’ fetch DB โ†’ store in cache.

async function getUser(id) {
  // Step 1 โ€” check cache
  const cached = await redis.get(`user:${id}`);
  if (cached) return JSON.parse(cached);

  // Step 2 โ€” cache miss, hit DB
  const user = await db.findUser(id);

  // Step 3 โ€” store in cache for next time
  await redis.set(`user:${id}`, JSON.stringify(user), 'EX', 3600);
  return user;
}

Enter fullscreen mode Exit fullscreen mode

โœ” Only caches what's actually requested
โœ” Cache failure doesn't break the app
โŒ First request always slow โ€” cold cache
โŒ Risk of stale data between TTL cycles


๐ŸŽฏ 2๏ธโƒฃ ๐—ช๐—ฟ๐—ถ๐˜๐—ฒ-๐—ง๐—ต๐—ฟ๐—ผ๐˜‚๐—ด๐—ต

๐Ÿ‘‰ Every write goes to cache AND database simultaneously

async function updateUser(id, data) {
  // Write to DB and cache together
  await db.updateUser(id, data);
  await redis.set(`user:${id}`, JSON.stringify(data), 'EX', 3600);
}

Enter fullscreen mode Exit fullscreen mode

โœ” Cache always in sync with DB
โœ” No stale reads after writes
โŒ Write latency increases โ€” two writes every time
โŒ Cache fills with data that may never be read

๐Ÿ‘‰ Best for: Read-heavy apps where freshness is critical


๐Ÿš€ 3๏ธโƒฃ ๐—ช๐—ฟ๐—ถ๐˜๐—ฒ-๐—•๐—ฒ๐—ต๐—ถ๐—ป๐—ฑ (๐—ช๐—ฟ๐—ถ๐˜๐—ฒ-๐—•๐—ฎ๐—ฐ๐—ธ)

๐Ÿ‘‰ Write to cache instantly. Sync to DB asynchronously later.

User writes โ†’ Cache โœ… (instant response)
                 โ†“ async worker (batched every 5s)
              Database ๐Ÿ• (eventually consistent)

Enter fullscreen mode Exit fullscreen mode

async function updateScore(userId, score) {
  // Instant write to cache
  await redis.set(`score:${userId}`, score);

  // Add to queue โ€” worker syncs to DB later
  await queue.add('syncScore', { userId, score });
}

Enter fullscreen mode Exit fullscreen mode

โœ” Blazing fast write performance
โœ” Reduces DB write load โ€” batch updates
โŒ Risk of data loss if cache crashes before sync
โŒ Complex to implement correctly

๐Ÿ‘‰ Best for: Leaderboards, analytics, gaming, counters


๐Ÿ”„ 4๏ธโƒฃ ๐—ฅ๐—ฒ๐—ฎ๐—ฑ-๐—ง๐—ต๐—ฟ๐—ผ๐˜‚๐—ด๐—ต

๐Ÿ‘‰ App only talks to cache. Cache fetches from DB on miss.

App โ†’ Cache โ†’ (hit)  โ†’ App โœ…
App โ†’ Cache โ†’ (miss) โ†’ DB โ†’ Cache populates โ†’ App โœ…

Enter fullscreen mode Exit fullscreen mode

// App never touches DB directly
const user = await cacheProvider.get(`user:${id}`);
// Cache provider handles DB fetch internally on miss

Enter fullscreen mode Exit fullscreen mode

โœ” App logic stays clean โ€” zero cache handling code
โœ” Cache always populated after first request
โŒ Cache provider must support read-through natively
โŒ First request latency still exists

๐Ÿ‘‰ Best for: Managed caches โ€” AWS ElastiCache, DAX


โฐ 5๏ธโƒฃ ๐—ฅ๐—ฒ๐—ณ๐—ฟ๐—ฒ๐˜€๐—ต-๐—”๐—ต๐—ฒ๐—ฎ๐—ฑ

๐Ÿ‘‰ Cache proactively refreshes data before TTL expires

TTL = 60s
At 45s โ†’ background job pre-fetches fresh data
At 60s โ†’ cache already has new data โœ… zero miss latency

Enter fullscreen mode Exit fullscreen mode

async function getWithRefreshAhead(key, fetchFn, ttl = 60) {
  const cached = await redis.get(key);
  const ttlRemaining = await redis.ttl(key);

  // Refresh when 75% of TTL has passed
  if (ttlRemaining < ttl * 0.25) {
    fetchFn().then(data =>
      redis.set(key, JSON.stringify(data), 'EX', ttl)
    );
  }

  return cached ? JSON.parse(cached) : fetchFn();
}

Enter fullscreen mode Exit fullscreen mode

โœ” No latency spikes on cache expiry
โœ” Always serving warm data
โŒ May refresh data that's never requested โ€” wasted compute

๐Ÿ‘‰ Best for: Homepages, dashboards, trending feeds


๐Ÿ”‘ 6๏ธโƒฃ ๐—–๐—ฎ๐—ฐ๐—ต๐—ฒ ๐—œ๐—ป๐˜ƒ๐—ฎ๐—น๐—ถ๐—ฑ๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐—ฆ๐˜๐—ฟ๐—ฎ๐˜๐—ฒ๐—ด๐—ถ๐—ฒ๐˜€

๐Ÿ‘‰ Knowing WHEN to clear cache is as important as caching itself

// TTL โ€” expire after fixed time
await redis.set('user:1', data, 'EX', 3600); // expires in 1hr

// Event-based โ€” clear on data change
async function updateUser(id, data) {
  await db.updateUser(id, data);
  await redis.del(`user:${id}`); // invalidate immediately
}

// Cache versioning โ€” bump version on deploy
const key = `user:${id}:v2`; // old v1 cache naturally expires

Enter fullscreen mode Exit fullscreen mode

โœ” TTL โ€” simple, automatic
โœ” Event-based โ€” precise, immediate
โœ” Versioning โ€” safe for deployments


๐Ÿšจ ๐—–๐—ฎ๐—ฐ๐—ต๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ฏ๐—น๐—ฒ๐—บ๐˜€ ๐—ฌ๐—ผ๐˜‚ ๐— ๐˜‚๐˜€๐˜ ๐—ž๐—ป๐—ผ๐˜„

// Cache Stampede โ€” TTL expires, 1000 users hit DB together
// Fix: mutex lock โ€” only one request rebuilds cache
const lock = await redis.set('lock:user:1', 1, 'NX', 'EX', 5);
if (lock) { /* fetch DB and repopulate */ }
else { /* wait and retry */ }

// Cache Penetration โ€” requests for non-existent data bypass cache
// Fix: cache null values too
await redis.set(`user:${id}`, 'NULL', 'EX', 60);

// Cache Avalanche โ€” all keys expire at same time
// Fix: add random jitter to TTL
const ttl = 3600 + Math.floor(Math.random() * 300);

Enter fullscreen mode Exit fullscreen mode


โš›๏ธ ๐—™๐—ฟ๐—ผ๐—ป๐˜๐—ฒ๐—ป๐—ฑ ๐—–๐—ฎ๐—ฐ๐—ต๐—ถ๐—ป๐—ด (๐—ฅ๐—ฒ๐—ฎ๐—ฐ๐˜)

// React Query โ€” cache-aside in the frontend
const { data } = useQuery({
  queryKey: ['user', id],
  queryFn: () => fetch(`/api/user/${id}`),
  staleTime: 5 * 60 * 1000,   // fresh for 5 mins
  cacheTime: 10 * 60 * 1000,  // keep in memory for 10 mins
});

Enter fullscreen mode Exit fullscreen mode

โœ” staleTime โ€” how long data is considered fresh
โœ” cacheTime โ€” how long unused data stays in memory
โœ” React Query implements cache-aside pattern automatically


๐Ÿšจ ๐—–๐—ผ๐—บ๐—บ๐—ผ๐—ป ๐— ๐—ถ๐˜€๐˜๐—ฎ๐—ธ๐—ฒ๐˜€

โŒ Caching without a TTL โ€” stale data lives forever
โŒ Not handling cache miss gracefully โ€” app crashes
โŒ Caching user-specific data globally โ€” data leaks
โŒ Using Write-Behind without a reliable queue
โŒ Ignoring cache stampede on high-traffic TTL expiry


๐Ÿ’ก ๐—ฆ๐—ฒ๐—ป๐—ถ๐—ผ๐—ฟ-๐—Ÿ๐—ฒ๐˜ƒ๐—ฒ๐—น ๐—œ๐—ป๐˜€๐—ถ๐—ด๐—ต๐˜

There are only two hard problems in computer science: cache invalidation and naming things.
Choosing the wrong strategy doesn't slow your app โ€” it silently corrupts it.


๐ŸŽฏ ๐—œ๐—ป๐˜๐—ฒ๐—ฟ๐˜ƒ๐—ถ๐—ฒ๐˜„ ๐—ข๐—ป๐—ฒ-๐—Ÿ๐—ถ๐—ป๐—ฒ๐—ฟ

Caching strategy is a tradeoff between consistency, latency, and complexity โ€” Cache-Aside for flexibility, Write-Through for consistency, Write-Behind for write performance, Read-Through for clean app logic, and Refresh-Ahead for zero miss latency โ€” with the right choice always depending on your read/write ratio, consistency requirements, and failure tolerance.


#SystemDesign #Backend #Caching #Redis #WebDevelopment #InterviewPrep #SoftwareEngineering #PerformanceOptimization #EngineeringMindset