In praise of memcached

j03b 102 points 40 comments June 23, 2026
jchri.st · View on Hacker News

Discussion Highlights (8 comments)

abofh

Oh God I'm tired of ai written thought pieces

kijin

Redis works great as a cache, but there are a few things you need to do in order to use it reliably as a cache. 1) Wrap your client library so that it's impossible to store anything without an expiry date. You don't want 6-months-old data suddenly coming up in your app! 2) Either turn off persistence, or use a separate database for the cache. In other words, don't mix volatile data with stuff you actually care about. 3) Set up a reasonable maxmemory value with an appropriate maxmemory-policy, so that Redis doesn't eat up all your RAM. 4) Resist the urge to use complex data structures. If you try to update a single field on an expired hash, you will end up with an incomplete object. If you don't want all that hassle, then yes, Memcached probably works better out of the box.

dvt

Memcached is meant to be a lightweight memory cache, which makes sense, but contrary to the article's claim that "Redis is brought into a stack as a cache, and it is run with the assumption that people treat it that way"—I have very very rarely experienced this. Redis is brought into a stack because (most importantly!) it's fast and (almost as importantly!) because it's simple. I don't think this article is written by AI, but (and I'm trying to be charitable here), it's just like.. dumb. > Dealing with memcached downtime is incredibly easy, because client libraries generally ignore connection exceptions. For instance, a simple get will just return the default value (or none) if the server is down. This is a terrible idea in the context of things that might use Redis. If you use Redis with some kind of complex state (say, a document if you're working on a Notion clone, for instance), wtf even is a "default value"? In fact, I actually also want to know when the thing is down. > Clustering memcached is wonderful, because memcached actually has no clustering built-in. Yeah bro, this is yet another one of the reasons people use Redis: it handles consensus and clustering for you . What even is this article? It's a master class in straw-manning architectural decisions: most people use hammers as hammers, but screwdrivers make great hammers too, especially if you also need to screw stuff in! I mean.. technically true?

jszymborski

An article praising memcached and no mention of the feral bunny mascots.

tempest_

I stopped using memcached a decade a go in favour of Redis and now use valkey. Never felt the need to go back to memcached except when a legacy dependency needed it.

kylewpppd

I think I've seen all of the Redis/Valkey issues the author mentioned in production. * Outages where Valkey had no memory policy, ate all the memory, and then caused write errors to its append-only file. Bonus points for another one where the disk itself was full, and AOF writes failed. * 500s where Redis was fully expected to be live, running, and populated with data for every user, and no fallback to a slower path. * Creative uses of sorted sets and other data structures which depended on the sets never being evicted. Despite the observations from the field, I think it's still hard to recommend memcache ahead of Redis. It can be difficult to architect an app to have a memcache-friendly cache layout. I'd almost guarantee a large enough team using memcache will find a way to need Redis. And then we're maintaining 2 cache technologies.

bawolff

I like memcached, but its really not redis's fault if you set it up as a volatile cache but people treat it as a persistent data store. The comparison is especially weird as memcached is also not persistent.

AussieWog93

I've done a bunch of Flask work over the past couple of years - not full time but as part of the tech stack for my small eCommerce business. Have run into all kinds of footguns and weirdness with MongoEngine, SQLAlchemy, Celery (seriously, if you value your sanity, don't use Celery!), the Python stacks for Google, eBay and Shopify but never Redis. Perhaps that's because I'm not giving admin access to random people who think that Redis is a persistent storage, but honestly it's one of those technologies I'd describe as absolutely rock solid and well designed. The API is dead basic and every time I need to do something slightly weird, there's a sensible and well thought out way to achieve it.

Semantic search powered by Rivestack pgvector
11,301 stories · 106,340 chunks indexed