FlatbreadLabs / flatbread

Consume relational, flat-file data using GraphQL in any static framework 🫓
57 stars 2 forks source link

Resolver Caching #11

Open tonyketcham opened 2 years ago

tonyketcham commented 2 years ago

We can store resolved fields which will come in handy for advanced, nested filtering. This can prevent the same node field from being calculated tens or even thousands of times over the course of sequential queries.

Some options to consider:

odama626 commented 2 years ago

what if we do hashing and dump everything into an sqlite db during generate schema and then filters can just be sql queries?

tonyketcham commented 2 years ago

I don't necessarily want to depend Flatbread's core directly on SQL. But I agree re: hashing and dumping into a DB of sorts; having the schema cached along with hashing loaded nodes & resolved fields should prevent unnecessary recalculations. Combined with a granular cache invalidation strategy for CRUD workflows, Flatbread should scale well to tens of thousands of content nodes with high performance.

tonyketcham commented 2 years ago

We could stand on the shoulders of giants and follow Gatsby's DB choice with LMDB, which is the fastest in-memory Node DB in town https://github.com/kriszyp/lmdb-js