Skip to content

Using cache reference for query UI menu#11099

Merged
mrproliu merged 6 commits intoapache:masterfrom
mrproliu:cache-menu
Jul 17, 2023
Merged

Using cache reference for query UI menu#11099
mrproliu merged 6 commits intoapache:masterfrom
mrproliu:cache-menu

Conversation

@mrproliu
Copy link
Copy Markdown
Contributor

  • If this pull request closes/resolves/fixes an existing issue, replace the issue number. Closes #.
  • Update the CHANGES log.

@mrproliu mrproliu added the enhancement Enhancement on performance or codes label Jul 16, 2023
@mrproliu mrproliu added this to the 9.6.0 milestone Jul 16, 2023
@mrproliu mrproliu requested review from kezhenxu94 and wu-sheng July 16, 2023 11:15
@sonatype-lift
Copy link
Copy Markdown

sonatype-lift bot commented Jul 16, 2023

Sonatype Lift is retiring

Sonatype Lift will be retiring on Sep 12, 2023, with its analysis stopping on Aug 12, 2023. We understand that this news may come as a disappointment, and Sonatype is committed to helping you transition off it seamlessly. If you’d like to retain your data, please export your issues from the web console.
We are extremely grateful and thank you for your support over the years.

📖 Read about the impacts and timeline

this.menuItemFuture = new CompletableFuture<>();
this.menuItemCache = CacheBuilder.newBuilder()
.maximumSize(1)
.refreshAfterWrite(moduleConfig.getUiMenuRefreshInterval(), TimeUnit.SECONDS)
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.

RefreshAfterWrite? Where would we write this cache?
Do I misread the codes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The cache would be read from the database and written into the cache when accessing the menu for the first time. After the writing is completed, a timer starts counting, and when it reaches a certain point, the data would be automatically rewritten.

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.

Why push first time late? This kind of mechanism usually is used for cold data, but menu is super hot. I think the timer should be up and running after initialized(if needed).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated, please re-check

wu-sheng
wu-sheng previously approved these changes Jul 16, 2023
Copy link
Copy Markdown
Member

@wu-sheng wu-sheng left a comment

Choose a reason for hiding this comment

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

@kezhenxu94 Another round check?

@mrproliu mrproliu merged commit 8b2fe88 into apache:master Jul 17, 2023
@mrproliu mrproliu deleted the cache-menu branch July 17, 2023 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Enhancement on performance or codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants