Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
portal-backend
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
HBP Medical Informatics Platform
portal-backend
Commits
4b02ab58
Commit
4b02ab58
authored
8 years ago
by
Mirco Nasuti
Browse files
Options
Downloads
Patches
Plain Diff
add caching on models
parent
8f10c01b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/eu/hbp/mip/controllers/ModelsApi.java
+9
-0
9 additions, 0 deletions
src/main/java/eu/hbp/mip/controllers/ModelsApi.java
with
9 additions
and
0 deletions
src/main/java/eu/hbp/mip/controllers/ModelsApi.java
+
9
−
0
View file @
4b02ab58
...
@@ -17,6 +17,9 @@ import io.swagger.annotations.*;
...
@@ -17,6 +17,9 @@ import io.swagger.annotations.*;
import
org.apache.log4j.Logger
;
import
org.apache.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.CachePut
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -57,6 +60,7 @@ public class ModelsApi {
...
@@ -57,6 +60,7 @@ public class ModelsApi {
@ApiOperation
(
value
=
"Get models"
,
response
=
Model
.
class
,
responseContainer
=
"List"
)
@ApiOperation
(
value
=
"Get models"
,
response
=
Model
.
class
,
responseContainer
=
"List"
)
@Cacheable
(
"Models"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
)
@RequestMapping
(
method
=
RequestMethod
.
GET
)
public
ResponseEntity
<
List
>
getModels
(
public
ResponseEntity
<
List
>
getModels
(
@ApiParam
(
value
=
"Only ask own models"
)
@RequestParam
(
value
=
"own"
,
required
=
false
)
Boolean
own
,
@ApiParam
(
value
=
"Only ask own models"
)
@RequestParam
(
value
=
"own"
,
required
=
false
)
Boolean
own
,
...
@@ -103,6 +107,8 @@ public class ModelsApi {
...
@@ -103,6 +107,8 @@ public class ModelsApi {
@ApiOperation
(
value
=
"Create a model"
,
response
=
Model
.
class
)
@ApiOperation
(
value
=
"Create a model"
,
response
=
Model
.
class
)
@ApiResponses
(
value
=
{
@ApiResponse
(
code
=
201
,
message
=
"Model created"
)
})
@ApiResponses
(
value
=
{
@ApiResponse
(
code
=
201
,
message
=
"Model created"
)
})
@CachePut
(
"Model"
)
@CacheEvict
(
value
=
"Models"
,
allEntries
=
true
)
@RequestMapping
(
method
=
RequestMethod
.
POST
)
@RequestMapping
(
method
=
RequestMethod
.
POST
)
public
ResponseEntity
<
Model
>
addAModel
(
public
ResponseEntity
<
Model
>
addAModel
(
@RequestBody
@ApiParam
(
value
=
"Model to create"
,
required
=
true
)
Model
model
@RequestBody
@ApiParam
(
value
=
"Model to create"
,
required
=
true
)
Model
model
...
@@ -189,6 +195,7 @@ public class ModelsApi {
...
@@ -189,6 +195,7 @@ public class ModelsApi {
}
}
@ApiOperation
(
value
=
"Get a model"
,
response
=
Model
.
class
)
@ApiOperation
(
value
=
"Get a model"
,
response
=
Model
.
class
)
@Cacheable
(
"model"
)
@RequestMapping
(
value
=
"/{slug}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/{slug}"
,
method
=
RequestMethod
.
GET
)
public
ResponseEntity
<
Model
>
getAModel
(
public
ResponseEntity
<
Model
>
getAModel
(
@ApiParam
(
value
=
"slug"
,
required
=
true
)
@PathVariable
(
"slug"
)
String
slug
@ApiParam
(
value
=
"slug"
,
required
=
true
)
@PathVariable
(
"slug"
)
String
slug
...
@@ -220,6 +227,8 @@ public class ModelsApi {
...
@@ -220,6 +227,8 @@ public class ModelsApi {
@ApiOperation
(
value
=
"Update a model"
,
response
=
Void
.
class
)
@ApiOperation
(
value
=
"Update a model"
,
response
=
Void
.
class
)
@ApiResponses
(
value
=
{
@ApiResponse
(
code
=
204
,
message
=
"Model updated"
)
})
@ApiResponses
(
value
=
{
@ApiResponse
(
code
=
204
,
message
=
"Model updated"
)
})
@CachePut
(
"model"
)
@CacheEvict
(
value
=
"Models"
,
allEntries
=
true
)
@RequestMapping
(
value
=
"/{slug}"
,
method
=
RequestMethod
.
PUT
)
@RequestMapping
(
value
=
"/{slug}"
,
method
=
RequestMethod
.
PUT
)
public
ResponseEntity
<
Void
>
updateAModel
(
public
ResponseEntity
<
Void
>
updateAModel
(
@ApiParam
(
value
=
"slug"
,
required
=
true
)
@PathVariable
(
"slug"
)
String
slug
,
@ApiParam
(
value
=
"slug"
,
required
=
true
)
@PathVariable
(
"slug"
)
String
slug
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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
register
or
sign in
to comment