HeyPuter / kv.js

⚡️ Advanced in-memory caching for JavaScript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cleanupLoop

SrJSDev opened this issue · comments

https://github.com/HeyPuter/kv.js/blob/main/kv.js#L2912

I think you mean to refence this.cleanupInterval?

Also, using a timer to cleanup expired keys is really inefficient and a huge performance suck--especially for a lot of ttl keys. I suggest at least making it optional, if not removing it entirely.

Hey, sorry for the late reply. The code is correct, this.cleanupInterval isn't used anywhere in the code right now and shouldn't be there.

As for your comments on performance, I agree. Even though KV.js is currently doing a great job for puter.com, which handles many requests, this is the naive approach to implementing key expiration. We will re-write most parts of the key expiration logic; however, we'd also appreciate it if the community wanted to try it 😁