Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Submit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EIP
Labrador
Submit
Merge requests
!103
Resolve "Make person cache timeout configurable"
Code
Review changes
Check out branch
Open in Workspace
Download
Patches
Plain diff
Expand sidebar
Merged
Resolve "Make person cache timeout configurable"
74-make-person-cache-timeout-configurable
into
development
Overview
0
Commits
1
Pipelines
0
Changes
2
Merged
Resolve "Make person cache timeout configurable"
Ruben Backx
requested to merge
74-make-person-cache-timeout-configurable
into
development
Aug 10, 2021
Overview
0
Commits
1
Pipelines
0
Changes
2
Closes
#74 (closed)
Edited
Aug 10, 2021
by
Ruben Backx
0
0
Merge request reports
Compare
development
version 2
554ea0bf
Aug 11, 2021
version 1
08724bcb
Aug 10, 2021
development (base)
and
latest version
latest version
554ea0bf
1 commit,
Aug 11, 2021
version 2
554ea0bf
3 commits,
Aug 11, 2021
version 1
08724bcb
1 commit,
Aug 10, 2021
2 files
+
9
−
4
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
src/main/java/nl/tudelft/submit/cache/PersonCacheManager.java
+
7
−
4
View file @ 554ea0bf
Edit in single-file editor
Open in Web IDE
Show full file
@@ -26,6 +26,7 @@ import nl.tudelft.labracore.api.dto.PersonSummaryDTO;
import
org.modelmapper.ModelMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.env.Environment
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.context.annotation.ApplicationScope
;
@@ -34,18 +35,20 @@ import org.springframework.web.context.annotation.ApplicationScope;
public
class
PersonCacheManager
extends
TimedCacheManager
<
Long
,
PersonSummaryDTO
>
{
private
Map
<
String
,
Long
>
usernameCache
=
new
ConcurrentHashMap
<>();
private
static
long
timeout
;
@Autowired
private
ModelMapper
mapper
;
@Autowired
private
PersonControllerApi
api
;
/**
* Creates a new person cache by setting the timeout on its timed cache implementation to 5 minutes.
*/
public
PersonCacheManager
()
{
super
(
5
*
60
*
1000L
);
@Autowired
public
PersonCacheManager
(
ModelMapper
mapper
,
PersonControllerApi
api
,
Environment
env
)
{
super
(
Long
.
parseLong
(
env
.
getProperty
(
"submit.cache.person-timeout"
))
*
1000L
);
this
.
mapper
=
mapper
;
this
.
api
=
api
;
}
public
PersonSummaryDTO
get
(
String
username
)
{
Loading