Skip to content

Cached statistics and all ontologies for ontologies tab and cleaned u…#700

Open
henrietteharmse wants to merge 2 commits intodevfrom
potential-slowness-fix
Open

Cached statistics and all ontologies for ontologies tab and cleaned u…#700
henrietteharmse wants to merge 2 commits intodevfrom
potential-slowness-fix

Conversation

@henrietteharmse
Copy link
Copy Markdown
Collaborator

…p logging on backend.

@haideriqbal
Copy link
Copy Markdown
Collaborator

Hi @henrietteharmse ! I like the idea of caching all ontologies endpoints as it doesn't change during our application lifecycle. However, if I understand it correctly, the current implementation of the endpoint doesn't technically cache the result unless I'm missing something. The new controller will still go to solr to retrieve the ontologies every time it's called.

I suggest we use Spring Cache which is straightforward to set up and can be helpful in our use case. Have a look at https://www.baeldung.com/spring-cache-tutorial

@henrietteharmse
Copy link
Copy Markdown
Collaborator Author

henrietteharmse commented Jul 15, 2024

The old endpoint is not caching it. I did look at the different Spring Cache solutions. However, we do not need all the functionality these solutions include and thus it is an overkill.

@henrietteharmse
Copy link
Copy Markdown
Collaborator Author

The new controller will still go to solr to retrieve the ontologies every time it's called.

That is not true. It only calls solr once and never again.

Copy link
Copy Markdown
Collaborator

@haideriqbal haideriqbal left a comment

Choose a reason for hiding this comment

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

LGTM!

@haideriqbal
Copy link
Copy Markdown
Collaborator

The new controller will still go to solr to retrieve the ontologies every time it's called.

That is not true. It only calls solr once and never again.

yup! i missed the variable bit here

"ontologies_all",
async (_, { rejectWithValue }) => {
const path = `api/v2/ontologies?size=1`;
const allOntologiesPath = `api/v2/cache/ontologies`;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there any reason we can't just make the cached endpoint the only endpoint instead of having a separate API route?

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.

3 participants