News for hackers. Stuff that matters.
Re:Do you need Redis? PostgreSQL does queuing, locking, and ... by halfcat on Sunday November 03, 2024 @05:59PM (#42036808)
Django has caching built in with support for Redis, and it also has an in-memory caching option which they label as “not for production” (because if you have multiple instances of Django serving requests, their in-memory caches will diverge which is...bad).

But for lots of cases, especially internal business tools, we can scale up a single instance for a long time, and this in-memory caching makes things super fast.

There’s a library, django-cachalot [1], that handles cache invalidation automatically any time a write happens to a table. That’s a rather blunt way to handle cache invalidation, but it’s wonderful because it will give you a boost for free with virtually no effort on your part, and if your internal business app has infrequent updates it basically runs entirely in RAM, and falls back to regular database queries if the data isn’t in the cache.

[1] https://github.com/noripyt/django-cachalot

There are no comments on this comment yet.