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
84d056b6
Commit
84d056b6
authored
8 years ago
by
Mirco Nasuti
Browse files
Options
Downloads
Patches
Plain Diff
workaround to evict cache session by session on Models and Articles
parent
415b25d4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/eu/hbp/mip/controllers/ArticlesApi.java
+13
-2
13 additions, 2 deletions
src/main/java/eu/hbp/mip/controllers/ArticlesApi.java
src/main/java/eu/hbp/mip/controllers/ModelsApi.java
+13
-2
13 additions, 2 deletions
src/main/java/eu/hbp/mip/controllers/ModelsApi.java
with
26 additions
and
4 deletions
src/main/java/eu/hbp/mip/controllers/ArticlesApi.java
+
13
−
2
View file @
84d056b6
...
@@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.CachePut
;
import
org.springframework.cache.annotation.CachePut
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.cache.annotation.Caching
;
import
org.springframework.context.annotation.Scope
;
import
org.springframework.context.annotation.Scope
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
...
@@ -82,7 +83,12 @@ public class ArticlesApi {
...
@@ -82,7 +83,12 @@ public class ArticlesApi {
@ApiOperation
(
value
=
"Create an article"
)
@ApiOperation
(
value
=
"Create an article"
)
@ApiResponses
(
value
=
{
@ApiResponse
(
code
=
201
,
message
=
"Article created"
)
})
@ApiResponses
(
value
=
{
@ApiResponse
(
code
=
201
,
message
=
"Article created"
)
})
@CachePut
(
value
=
"Article"
,
key
=
"#article.getSlug() + #root.target"
)
@CachePut
(
value
=
"Article"
,
key
=
"#article.getSlug() + #root.target"
)
@CacheEvict
(
value
=
"Articles"
,
allEntries
=
true
)
@Caching
(
evict
=
{
@CacheEvict
(
value
=
"Articles"
,
key
=
"'false' + 'draft' + #root.target"
),
@CacheEvict
(
value
=
"Articles"
,
key
=
"'false' + 'published' + #root.target"
),
@CacheEvict
(
value
=
"Articles"
,
key
=
"'true' + 'draft' + #root.target"
),
@CacheEvict
(
value
=
"Articles"
,
key
=
"'true' + 'published' + #root.target"
)
})
@RequestMapping
(
method
=
RequestMethod
.
POST
)
@RequestMapping
(
method
=
RequestMethod
.
POST
)
public
ResponseEntity
<
Void
>
addAnArticle
(
public
ResponseEntity
<
Void
>
addAnArticle
(
@RequestBody
@ApiParam
(
value
=
"Article to create"
,
required
=
true
)
@Valid
Article
article
@RequestBody
@ApiParam
(
value
=
"Article to create"
,
required
=
true
)
@Valid
Article
article
...
@@ -173,7 +179,12 @@ public class ArticlesApi {
...
@@ -173,7 +179,12 @@ public class ArticlesApi {
@ApiOperation
(
value
=
"Update an article"
)
@ApiOperation
(
value
=
"Update an article"
)
@ApiResponses
(
value
=
{
@ApiResponse
(
code
=
204
,
message
=
"Article updated"
)
})
@ApiResponses
(
value
=
{
@ApiResponse
(
code
=
204
,
message
=
"Article updated"
)
})
@CachePut
(
value
=
"Article"
,
key
=
"#slug + #root.target"
)
@CachePut
(
value
=
"Article"
,
key
=
"#slug + #root.target"
)
@CacheEvict
(
value
=
"Articles"
,
allEntries
=
true
)
@Caching
(
evict
=
{
@CacheEvict
(
value
=
"Articles"
,
key
=
"'false' + 'draft' + #root.target"
),
@CacheEvict
(
value
=
"Articles"
,
key
=
"'false' + 'published' + #root.target"
),
@CacheEvict
(
value
=
"Articles"
,
key
=
"'true' + 'draft' + #root.target"
),
@CacheEvict
(
value
=
"Articles"
,
key
=
"'true' + 'published' + #root.target"
)
})
@RequestMapping
(
value
=
"/{slug}"
,
method
=
RequestMethod
.
PUT
)
@RequestMapping
(
value
=
"/{slug}"
,
method
=
RequestMethod
.
PUT
)
public
ResponseEntity
<
Void
>
updateAnArticle
(
public
ResponseEntity
<
Void
>
updateAnArticle
(
@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.
src/main/java/eu/hbp/mip/controllers/ModelsApi.java
+
13
−
2
View file @
84d056b6
...
@@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
...
@@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.CachePut
;
import
org.springframework.cache.annotation.CachePut
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.cache.annotation.Caching
;
import
org.springframework.context.annotation.Scope
;
import
org.springframework.context.annotation.Scope
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
...
@@ -108,7 +109,12 @@ public class ModelsApi {
...
@@ -108,7 +109,12 @@ 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
(
value
=
"Model"
,
key
=
"#model.getSlug() + #root.target"
)
@CachePut
(
value
=
"Model"
,
key
=
"#model.getSlug() + #root.target"
)
@CacheEvict
(
value
=
"Models"
,
allEntries
=
true
)
@Caching
(
evict
=
{
@CacheEvict
(
value
=
"Models"
,
key
=
"'false' + 'false' + #root.target"
),
@CacheEvict
(
value
=
"Models"
,
key
=
"'false' + 'true' + #root.target"
),
@CacheEvict
(
value
=
"Models"
,
key
=
"'true' + 'false' + #root.target"
),
@CacheEvict
(
value
=
"Models"
,
key
=
"'true' + 'true' + #root.target"
)
})
@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
...
@@ -228,7 +234,12 @@ public class ModelsApi {
...
@@ -228,7 +234,12 @@ 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
(
value
=
"model"
,
key
=
"#slug + #root.target"
)
@CachePut
(
value
=
"model"
,
key
=
"#slug + #root.target"
)
@CacheEvict
(
value
=
"Models"
,
allEntries
=
true
)
@Caching
(
evict
=
{
@CacheEvict
(
value
=
"Models"
,
key
=
"'false' + 'false' + #root.target"
),
@CacheEvict
(
value
=
"Models"
,
key
=
"'false' + 'true' + #root.target"
),
@CacheEvict
(
value
=
"Models"
,
key
=
"'true' + 'false' + #root.target"
),
@CacheEvict
(
value
=
"Models"
,
key
=
"'true' + 'true' + #root.target"
)
})
@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