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

Cache next entry arguments #13

Open
adzialocha opened this issue Feb 21, 2023 · 1 comment · May be fixed by #18
Open

Cache next entry arguments #13

adzialocha opened this issue Feb 21, 2023 · 1 comment · May be fixed by #18

Comments

@adzialocha
Copy link
Member

adzialocha commented Feb 21, 2023

Since we introduced querying the next entry arguments based on document view ids the old caching logic didnt't work anymore, we need a new solution!

Caching keys were organized as ${publicKey}/${viewId}, which means that it will just make an entry in the cache after every next entry request - but never hit it afterwards, as the view id changes constantly with each request. The cache just fills up but is never really used.

To bring back caching we need to extend the API with something which allows us to handle document instances and either persist the document id across a whole session (easy) or record the whole operation graph locally as well (hard).

@adzialocha
Copy link
Member Author

adzialocha commented Feb 21, 2023

Sketchy idea for a high-level API (def. needs more thinking, but you get the idea):

const session = new Session('http://localhost:2020/graphql').setKeyPair(new KeyPair());
const document = new Document('chat_0020...');

const viewId = await document.create({
  message: 'Hello, new API',
}, session);

await document.update({
  message: 'This UPDATE was using cached next entry arguments',
}, session);

@adzialocha adzialocha changed the title Introduce caching layer Cache next entry arguments Feb 21, 2023
@adzialocha adzialocha linked a pull request Feb 28, 2023 that will close this issue
4 tasks
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

Successfully merging a pull request may close this issue.

1 participant