Hacker News new | ask | show | jobs
by hoppp 297 days ago
The cache service is a database of sorts that usually stores key value pairs.

The difference is in persistence and scaling and read/write permissions

2 comments

No, what makes a cache a cache is invalidation. A cache is stale data. It's a latent out of date calculation. It's misinformation that risks surviving until it lies to the user.
This is true but a lot of the trouble in invalidation can be avoided by using smarter cache keys.

For example, on reddit, fully rendered comments are cached, so that the renderer doesn't have to redo its work. But the cache key includes the date of the last edit on the comment, which is already known when requesting the value from the cache. In this way, you never have to invalidate that key, because editing the comment makes a new key. The old one will just get ejected eventually.

ie A cache is a database. The difference is features and usage.
A database is usually a union of all of the questions that can be asked about a topic. A cache by definition is a subset of that. Subsets are not the sets. And if you treat them as if they are, which 90% of people do, you’re gonna have a bad time.
> A database is usually a union of all of the questions that can be asked about a topic

That's some AI level sophism.

A database is a durable store of data that can be modified and read. Ostensibly, we're talking about computer databases. You can define the soft terms at your leisure and to suit your needs. There are many categories of discussion that will never intersect with this definition. Communication is not a database. Art is not a database. History is not a database. Medicine is not a database. et al.

A cache is a database. Differentiating a cache and database by label is a misnomer.

> That's some AI level sophism.

Oh fuck off. Calling everything AI is so 2024.

A database is a system of record. It can also be a source of truth. A cache is neither. Treating it as one is dangerous. Insisting others should is idiocy.

> A database is a system of record. It can also be a source of truth.

This is meaningless. A cache is used in lieu of the value because it's considered equivalent.

> Insisting others should is idiocy.

I did no such thing. Good luck with whatever.