<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Manasvidadhich on Medium]]></title>
        <description><![CDATA[Stories by Manasvidadhich on Medium]]></description>
        <link>https://medium.com/@manasvidadhich05?source=rss-85e444086a53------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*zmgFZTrxVVoIpFbp</url>
            <title>Stories by Manasvidadhich on Medium</title>
            <link>https://medium.com/@manasvidadhich05?source=rss-85e444086a53------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 13:08:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@manasvidadhich05/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Redis in Plain English: Use Cases Every Developer Should Know]]></title>
            <link>https://medium.com/@manasvidadhich05/redis-in-plain-english-use-cases-every-developer-should-know-7e2e1f4783a6?source=rss-85e444086a53------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e2e1f4783a6</guid>
            <category><![CDATA[redis-cluster]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[backend]]></category>
            <dc:creator><![CDATA[Manasvidadhich]]></dc:creator>
            <pubDate>Sun, 05 Apr 2026 18:56:01 GMT</pubDate>
            <atom:updated>2026-04-05T18:56:01.171Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Redis isn’t just a cache. It’s a Swiss Army knife for building fast &amp; scalable apps with Node.js, it’s incredibly easy to use.</em></p><p>If you’ve been in web development for even a little while, you’ve probably heard someone say “just throw Redis at it.” But what <em>is</em> Redis, exactly, and why does everyone seem to love it?</p><p>Redis (Remote Dictionary Server) is an <strong>in-memory data store</strong> ,it keeps data in RAM instead of disk, making it blazingly fast. Think of it as a giant shared dictionary your whole app can read and write to in microseconds.</p><p>We’ll use <strong>ioredis</strong>, the most popular Redis client for Node.js. Install it once and import it everywhere:</p><pre>npm install ioredis</pre><pre>// redis.js — create this once, import everywhere<br>import Redis from &#39;ioredis&#39;;<br>const redis = new Redis(); // connects to localhost:6379 by default<br>export default redis;</pre><p>What we’ll cover</p><ol><li>Caching — the classic</li><li>Session storage</li><li>Rate limiting</li><li>Leaderboards with sorted sets</li><li>Pub/Sub messaging</li></ol><h3>1. Caching (most common)</h3><p>Imagine fetching a user’s profile from your DB on every request that might take 200ms. But withRedis, you cache it after the first fetch. Every subsequent request responds in under 1ms.</p><pre>import redis from &#39;./redis.js&#39;;</pre><pre>async function getUserProfile(userId) {<br>  const cacheKey = `user:${userId}`;<br>  const cached = await redis.get(cacheKey);</pre><pre>  if (cached) {<br>    return JSON.parse(cached); <br>    // fast path — served from Redis<br>  }</pre><pre>  const user = await db.query(&#39;SELECT * FROM users WHERE id = ?&#39;, [userId]);</pre><pre>  await redis.setex(cacheKey, 3600, JSON.stringify(user)); <br>  // cache for 1 hour<br>  return user;<br>}</pre><p>setex sets the key with a TTL (time-to-live) of 3600 seconds so it auto expires after an hour. No stale data piling up forever</p><blockquote>This pattern is called <strong>cache-aside</strong> (or lazy loading): check the cache first, fall back to the DB on a miss, then populate the cache. It’s the most widely used caching pattern.</blockquote><h3>2. Session storage (very common)</h3><p>When a user logs in, you need to remember who they are across requests. Redis is perfect for sessions: fast reads, easy TTL for auto-logout, and it works across multiple servers out of the box.</p><pre>import { randomUUID } from &#39;crypto&#39;;<br>import redis from &#39;./redis.js&#39;;<br><br>// On login — store the session<br>async function createSession(userId, role) {<br>  const sessionId = randomUUID();<br>  const sessionData = { userId, role, loginTime: Date.now() };<br><br>  await redis.setex(<br>    `session:${sessionId}`,<br>    86400,                         // expires in 24 hours<br>    JSON.stringify(sessionData)<br>  );<br>  return sessionId; // send this to the client as a cookie<br>}<br><br>// On each request — verify the session<br>async function getSession(sessionId) {<br>  const data = await redis.get(`session:${sessionId}`);<br>  if (!data) return null; // session expired or invalid<br>  return JSON.parse(data);<br>}<br></pre><p>The big win: when you scale to 5 app servers, every server reads from the same Redis instance. No “sticky sessions”, no sync headaches.</p><h3>3.Rate limiting (important)</h3><p>You want to allow each user only 100 API calls per minute. Redis makes this trivially easy with atomic increment operations perfect as an Express middleware.</p><pre>import redis from &#39;./redis.js&#39;;<br><br>async function rateLimiter(req, res, next) {<br>  const userId = req.user?.id || req.ip;<br>  const minute = Math.floor(Date.now() / 60000);<br>  const key = `rate:${userId}:${minute}`;<br><br>  const count = await redis.incr(key);     // atomic increment<br>  if (count === 1) {<br>    await redis.expire(key, 60);           // reset after 1 minute<br>  }<br><br>  if (count &gt; 100) {<br>    return res.status(429).json({ error: &#39;Too many requests&#39; });<br>  }<br>  next();<br>}<br><br>// Usage in Express<br>app.use(&#39;/api&#39;, rateLimiter);</pre><p>The key insight: INCR is atomic even with 10,000 concurrent requests, Redis increments the counter correctly every time. No race conditions.</p><h3>4. Leaderboards with sorted sets</h3><p>Redis has a native <strong>Sorted Set: </strong>each member has a numeric score and Redis keeps them sorted automatically. Perfect for game leaderboards or activity feeds.</p><pre>import redis from &#39;./redis.js&#39;;<br><br>// Update a player&#39;s score<br>await redis.zadd(&#39;leaderboard:global&#39;, 9500, &#39;player:42&#39;);<br><br>// Get top 10 players (highest scores first)<br>const top10 = await redis.zrevrange(<br>  &#39;leaderboard:global&#39;, 0, 9, &#39;WITHSCORES&#39;<br>);<br>// → [&#39;player:42&#39;, &#39;9500&#39;, &#39;player:7&#39;, &#39;8800&#39;, ...]<br><br>// Get a specific player&#39;s rank (0 = #1)<br>const rank = await redis.zrevrank(&#39;leaderboard:global&#39;, &#39;player:42&#39;);<br>console.log(`Player is ranked #${rank + 1}`);</pre><p>This would require complex SQL queries and careful indexing in a traditional database. In Redis, it’s one command and it’s O(log N) fast.</p><h3>5. Pub/Sub messaging</h3><p>Need to push real-time events between services like notifying a notification service when a new order arrives? Redis Pub/Sub lets publishers broadcast to any number of subscribers instantly.</p><p>With ioredis you need <strong>two separate clients</strong> :one for subscribing (it enters a special mode) and one for publishing.</p><pre>import Redis from &#39;ioredis&#39;;<br><br>const publisher  = new Redis();<br>const subscriber = new Redis(); // separate client for sub mode<br><br>// Subscriber — listen for new orders<br>await subscriber.subscribe(&#39;orders:new&#39;);<br><br>subscriber.on(&#39;message&#39;, (channel, message) =&gt; {<br>  const order = JSON.parse(message);<br>  console.log(`New order #${order.orderId} for $${order.total}`);<br>  sendPushNotification(order.userId, &#39;Your order was placed!&#39;);<br>});<br><br>// Publisher — fire when a new order is created<br>async function placeOrder(orderData) {<br>  await db.insert(orderData);<br>  await publisher.publish(&#39;orders:new&#39;, JSON.stringify(orderData));<br>}</pre><p>Multiple services can subscribe to the same channel. When an event fires, all of them receive it simultaneously — great for decoupling microservices.</p><blockquote><strong>Quick tip:</strong> Redis isn’t a replacement for your main database — it’s a complement to it. Think of Redis as your app’s short-term memory (fast, temporary) and your SQL/NoSQL DB as its long-term memory (persistent, queryable).</blockquote><h3>Wrapping up</h3><p>Redis might seem like “just a cache” at first glance, but as you’ve seen, it’s a remarkably versatile tool. With ioredis and a handful of commands, you can build fast caches, secure sessions, bulletproof rate limiters, real-time leaderboards, and event driven systems all in clean async/await Node.js.</p><p><em>The best way to learn Redis is to pick one use case from this list and implement it in your next project. Start with caching, it’s the easiest win and you’ll immediately feel the difference. Happy building!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e2e1f4783a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to be to 1% ?]]></title>
            <link>https://medium.com/@manasvidadhich05/how-to-be-to-1-60c09ba7c27d?source=rss-85e444086a53------2</link>
            <guid isPermaLink="false">https://medium.com/p/60c09ba7c27d</guid>
            <category><![CDATA[discipline]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[hard-work]]></category>
            <category><![CDATA[reliability]]></category>
            <dc:creator><![CDATA[Manasvidadhich]]></dc:creator>
            <pubDate>Tue, 03 Feb 2026 14:32:09 GMT</pubDate>
            <atom:updated>2026-02-03T14:32:09.086Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to be to top 1% ?</h3><p>If you’re trying to get your life together, build a routine, and thinking, <em>“Tomorrow I’ll wake up early, work out, and get things done”</em> .Trust in God, you are condemned to fail.</p><p>You think that resisting your thoughts and trying to control your feelings will suddenly get you everything you want, but that is just your mind playing games with you.</p><p>This is often called delusion.</p><p>Believing that willpower alone will take you to your goals is nonsense, because:</p><h3>WILLPOWER IS FOR LOSERS</h3><p>Murphy’s Law says:<br> <em>“Anything that can go wrong will eventually go wrong.”</em></p><p>So depending only on willpower is setting yourself up for failure.</p><p>One day you will lose that willpower — and then what?<br> You will become the same person you no longer want to be.</p><p>For example: you try waking up at 6 AM and think, <em>“From tomorrow, I will conquer the world.”</em><br> You may do it for a week, or even a month, but eventually you are meant to fail…</p><p>Because motivation fades.</p><p>Remember:</p><h3>BOTH WINNERS AND LOSERS HAVE THE SAME GOALS</h3><p>So what actually works?</p><h3>SYSTEMS + DELAYED GRATIFICATION</h3><p>This is a killer combination.</p><p>Build systems around your routine.<br> Follow them consistently.</p><p>A system is your process.</p><p>If you’re a musician, your goal might be to play a new piece.<br> Your system is how often you practice, how you break down hard parts, and how you get feedback.</p><p>Create systems whose results come through delayed gratification.</p><p>A step backward after a wrong turn is still a step in the right direction.</p><p>Power is not <em>feeling</em> like your life is in control rather it is actually having control.</p><p>Practice delayed gratification even in the smallest things.</p><h3>WILLPOWER LOSES ON BAD DAYS. SYSTEMS DON’T.</h3><p>Systems come from momentum, not motivation.</p><p>Your brain hates habits but loves patterns.</p><h3>MOMENTUM &gt; MOTIVATION</h3><p>You never rise to the level of your goals.<br> You fall to the level of your systems.</p><p>And a year from now, you’ll wish you had started today.</p><p>Live by this:</p><p><strong>Hell is meeting, on your last day on Earth, the person you could have become.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60c09ba7c27d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>