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

Fix cache key issue #185

Closed
wants to merge 1 commit into from
Closed

Fix cache key issue #185

wants to merge 1 commit into from

Conversation

@culmat
Copy link
Contributor

@culmat culmat commented May 19, 2014

The cache was not finding any repos with upper case letters in repo name. This fix reduces repo page load time on our installation from > 3 sec to 1.5 sec.

The cache was not finding any repos with upper case letters in repo name. This fix reduces repo page load time on our installation from > 3 sec to 1.5 sec.
@@ -683,7 +683,7 @@ public RepositoryModel getRepositoryModel(String repositoryName) {
repositoryName = repositoryName.replace("%7E", "~").replace("%7e", "~");

if (!repositoryListCache.containsKey(repositoryName)) {

This comment has been minimized.

@gitblit

gitblit May 19, 2014
Owner

We have to be careful when manipulating repository look-ups. The cache lookups should be case-insensitive - but the filesystem lookups are case-sensitive on case-sensitive filesystems.

I think the better fix is to ensure that cache lookups use the proper key, but leave the file system loading as-is. Try the following and let me know if that yields the same time-saving result.

String repositoryKey = repositoryName.toLowerCase();
if (!repositoryListCache.containsKey(repositoryKey)) {
    RepositoryModel model = loadRepositoryModel(repositoryName);
    ...
}

// cached model
RepositoryModel model = repositoryListCache.get(repositoryKey);
@gitblit
Copy link
Owner

@gitblit gitblit commented May 21, 2014

@culmat Have you tried my counter proposal?

@culmat
Copy link
Contributor Author

@culmat culmat commented May 21, 2014

Hi James,
haven't tried yet, but in my understanding it must be the same. When you Alt+Shift+I inline in Eclipse it should yield the exact same code?

@gitblit
Copy link
Owner

@gitblit gitblit commented May 22, 2014

I pushed my proposed fix.

@gitblit gitblit closed this May 22, 2014
@culmat culmat deleted the culmat:patch-1 branch Sep 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants