codetheweb / anylist

📋 a wrapper for AnyList's API (unoffical, reverse engineered)
88 stars 23 forks source link

Caching credentials and data #41

Open jchadwick opened 9 months ago

jchadwick commented 9 months ago

As it stands (at least from what I can tell), user credentials are stored on disk and data is stored in memory.

Neither of these things work well in a stateless, multi-user server-side scenario. Would be nice to have a cache implementation.

In my project I used keyv as the direct dependency/interface which allows you to use a variety of backends, including in-memory, file-based, and (of course) distributed caches. It also allows you to use TTLs to manage the data more effectively. If you like the idea, I can make a PR.

codetheweb commented 9 months ago

keyv works for me. Alternatively just allowing any object implementing get() / set() could work too.