damccull / ravendb_client

2 stars 0 forks source link

Cache documents locally in DocumentStore #5

Open damccull opened 2 years ago

damccull commented 2 years ago

The DocumentStore should cache documents locally to avoid running back to the server whenever possible, with cache invalidation rules being followed.

Need to find out if this just stores basic documents and handles putting them together for relationships, or if it stores pre-packed related documents where a sub-document is already a part of the higher one instead of the higher one holding id references. If it is the case that they're pre-merged, how are the keys and queries being stored for future use. If not the case, how is the library combining them on the fly and allowing for searches?

Caching different types locally in a deserialized manner can be done similarly to:

let filecabinet = AnyMap();
filecabinet.insert(HashMap<TypeA, type_a_struct>);
filecabinet.insert(HashMap<TypeB, type_b_struct);

Consider anymap, typemap, or manually implementing something with the Any trait.