Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarification on caching all items and fetching only changed items #55

Open
jrvarma opened this issue Oct 18, 2024 · 0 comments
Open

Clarification on caching all items and fetching only changed items #55

jrvarma opened this issue Oct 18, 2024 · 0 comments

Comments

@jrvarma
Copy link
Contributor

jrvarma commented Oct 18, 2024

I am trying to use Etebase's Local Cache to recreate the Etesync 1.0 sync functionality where the local cache could be updated with only changed items.

My plan is as follows:

At end of day

  • Use item_mgr.cache_save(item) to save the item to cache. Presumably, I would have to put this in a loop (for item in items:) to save all items to local storage.
  • Also store items.stoken to local storage.

Come back next day

  • Run a item_mgr.cache_load(cache_blob) loop to load all items.
  • Fetch new items with items = item_mgr.list(FetchOptions().stoken(stoken))

What I do not understand is how to merge the cache and the new/updated items. One possibility is to convert items into a python dict with uid as key and do something like
updated_items_dict = cached_items_dict.update(new_items_dict)

Would appreciate any help on how to go about doing this.

Also the python source code contains a function cache_save_with_content. Is this of any use in this context? I can understand python code but not rust

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant