Creating an issue in case people have the same question.
I am not fully happy with the namespace system we have. Not enough for easy invalidation. So I would love to have tags and it's planned, but it's quite a tricky thing to nail down, especially in bentocache, where we have a lot of different features
I've been doing quite a bit of research on the topic and should try an implementation when I have some time. The API will be super simple:
await bento.getOrSet({
key: 'foo',
factory: getFromDb(),
tags: ['tag-1', 'tag-2']
});
await bento.set({
key: 'foo',
tags: ['tag-1']
});
Then, we could delete all entries tagged with tag-1
using:
await bento.delete({ tag: 'tag-1' });
This would remove all entries that have the tag-1
tag.
It's likely that this tagging system will deprecate the current namespace system we have. I think they would become useless once we have tags. We would keep namespaces until v2, but they would be marked as deprecated via JSDoc
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too