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
Commits
18f86bb3
Commit
18f86bb3
authored
Aug 11, 2021
by
Otto Visser
Browse files
Options
Downloads
Plain Diff
Merge branch '74-make-person-cache-timeout-configurable' into 'development'
Resolve "Make person cache timeout configurable" Closes
#74
See merge request
!103
parents
8824c471
554ea0bf
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!105
Development
,
!103
Resolve "Make person cache timeout configurable"
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/nl/tudelft/submit/cache/PersonCacheManager.java
+7
-4
7 additions, 4 deletions
...main/java/nl/tudelft/submit/cache/PersonCacheManager.java
src/main/resources/application.template.yaml
+2
-0
2 additions, 0 deletions
src/main/resources/application.template.yaml
with
9 additions
and
4 deletions
src/main/java/nl/tudelft/submit/cache/PersonCacheManager.java
+
7
−
4
View file @
18f86bb3
...
...
@@ -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
)
{
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/application.template.yaml
+
2
−
0
View file @
18f86bb3
...
...
@@ -30,6 +30,8 @@ submit:
username
:
{{
auta-username
}}
password
:
{{
auta-password
}}
timeout
:
1800
# in seconds
cache
:
person-timeout
:
60
# in seconds
spring
:
profiles
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment