9 ms·
so how would you approach this?
by chilling 2y ago
so how would you approach this?
- porridgeraisin 2y agoJust do hincrby alone, if it doesn't exist it will automatically become 1
- chilling 2y agoYou are right. It just should be like so: Get: const likes = (await kv.hget(postTitle, "likes")) || 0 Post: const likes = await kv.hincrby(postTitle, "likes", 1);