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

add user rdf types cache #1935

Merged
merged 4 commits into from Sep 16, 2021
Merged

add user rdf types cache #1935

merged 4 commits into from Sep 16, 2021

Conversation

pwinckles
Copy link
Collaborator

@pwinckles pwinckles commented Sep 9, 2021

JIRA Ticket: https://fedora-repository.atlassian.net/browse/FCREPO-3732

What does this Pull Request do?

Adds a cache for user rdf types so that they do not need to be repeatedly loaded from disk.

How should this be tested?

Everything should work the same as before except triples should never be loaded from disk when creating or updating resources. I added a new debug log that will log every time a resource's triples are loaded. If you enable debug logging you should be able to confirm that the triples are no longer read when creating resources.

Key things to look at:

  1. Triples are not read when creating/updating any resource
  2. Updating resources in transactions works and does not bleed outside the tx

Interested parties

@fcrepo/committers

@pwinckles pwinckles changed the title Draft: add user rdf types cache add user rdf types cache Sep 10, 2021
assertThat(types, containsInAnyOrder(ANIMAL_TYPE));

types = cache.getUserTypes(fedoraId, sessionId2, rdfSupplier(ANIMAL_TYPE, CAT_TYPE));
assertThat(types, containsInAnyOrder(ANIMAL_TYPE, CAT_TYPE));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I get what you mean here, but just wondering. If you called

types = cache.getUserTypes(fedoraId, sessionId2, noCallSupplier());

would types == emptyList()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because the noCallSupplier() throws an exception when it's called. It's just used in the tests to ensure that the values are returned from the cache and were not newly loaded.

Copy link
Collaborator

@whikloj whikloj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@dbernstein dbernstein merged commit 1d9929e into fcrepo:main Sep 16, 2021
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 this pull request may close these issues.

None yet

3 participants