Skip to content

Use-case #8

Answered by jelveh
lorikku asked this question in Q&A
Apr 20, 2023 · 2 comments · 5 replies
Discussion options

You must be logged in to vote

You're right, I missed the part about kv.js vs variables.

For simple set, get, del,... using variables is the obvious choice. Things get a little redundant when we need expire, expireat and other secondary operations where, for example, we need a loop to check for expiry and "garbage collection". Before kv.js I had to re-write these for every use case e.g. rate-limiting, token caching, etc. so I just abstracted these parts away into a class called kvjs.

There is also one more thing to note, expire, ttl... seem simple on the surface but in order to do them efficiently we need to do a lot of non-trivial optimizations (e.g. the check interval should be as long as the shortest ttl). This is n…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
5 replies
@ama-coder
Comment options

@lorikku
Comment options

@jelveh
Comment options

Answer selected by lorikku
@ama-coder
Comment options

@jelveh
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants