azu / express-session-cloudflare-kv

A cloudflare workers KV based express session store.
MIT License
8 stars 1 forks source link

Misleading README? #2

Open trainiac opened 2 years ago

trainiac commented 2 years ago

Full disclosure, I don't work for Cloudflare but have been trying to learn the uses of KV.

On your readme you write:

You should not use this session store in production. Cloudflare Workers KV is eventually-consistent. So It is not suitable for session manager.

I think this is misleading. Reading the Cloudflare website they do say the data is "eventually-consistent" but they also say:

KV achieves this performance by being eventually-consistent. Changes are immediately visible in the edge location at which they are made, but may take up to 60 seconds to propagate to all other data centers.

So for session storage that is meant only for one user in one location (which is a very common use case), their data will always be consistent for them. In addition Cloudflare recommends it for usage for integrations like Remix. https://blog.cloudflare.com/remix-on-cloudflare-pages/.

If I'm missing something please let me know but I just want to help others learning about KV what it's true limitations and features are.

azu commented 2 years ago

In my experince, I could not read latest data immidately after write data. (if I'm correct, I have needed to wait a few seconds). It may read write to same edge location. (I forgot the code, but This PR is related) As a result, I added the sentence to README.

It may be a bug of express-session-cloudflare-kv.

205g0 commented 9 months ago

but why did you create this repo in the first place if CF KV is not suited for session because of its non-consistency?