saeho
saeho4w ago

Using Deno.KV twice

I want to use Deno.kv twice. One in local memory and 1 persistent in database shared across multiple instances. Is that a good idea? And to do that, should I open two instances of Deno.openKv() in my app?
2 Replies
saeho
saeho4w ago
For reference, my current app is load balanced across 3 instances. So I'm thinking of opening a second KV for values that need to be shared across the 3 load balanced instances. And use the memory KV for values that's fine to be local for that 1 instance only. (I'm also considering Deno deploy instead of using my instances, but still, I'd like to know more about using Deno.Kv twice)
Deno AI Helper
I wasn't able to find the answer to your question in the official Deno documentation. However, based on your message, it seems like you're looking to use key-value storage in two different ways: one for local memory and another for a persistent database that can be shared across multiple instances. While I can't provide a definitive answer from the documentation, it's generally a common practice to use different storage strategies for different purposes in an application. If Deno's KV storage system supports the use cases you're describing, it would make sense to open two separate instances with Deno.openKv(), one for each use case. Please note that this advice is not based on the Deno documentation, and I would recommend double-checking the accuracy of this advice. Make sure to review the latest Deno documentation or seek further clarification from the Deno community for the best practices and implementation details regarding the use of Deno's KV storage.