Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
App Blocks
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Genesys PGR
App Blocks
Commits
d6c0215d
Commit
d6c0215d
authored
Jan 05, 2020
by
Matija Obreza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
@Cacheable ClassPKServiceImpl#getClassPk()
- Improves performance of many methods
parent
3aa4884c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
auditlog/src/main/java/org/genesys/blocks/auditlog/service/impl/ClassPKServiceImpl.java
...esys/blocks/auditlog/service/impl/ClassPKServiceImpl.java
+2
-0
auditlog/src/test/java/org/genesys/blocks/auditlog/test/ApplicationConfig.java
...a/org/genesys/blocks/auditlog/test/ApplicationConfig.java
+2
-3
No files found.
auditlog/src/main/java/org/genesys/blocks/auditlog/service/impl/ClassPKServiceImpl.java
View file @
d6c0215d
...
...
@@ -23,6 +23,7 @@ import org.genesys.blocks.persistence.ClassPKRepository;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Isolation
;
import
org.springframework.transaction.annotation.Propagation
;
...
...
@@ -51,6 +52,7 @@ public class ClassPKServiceImpl implements ClassPKService {
*/
@Override
@Transactional
(
isolation
=
Isolation
.
DEFAULT
,
propagation
=
Propagation
.
REQUIRES_NEW
)
@Cacheable
(
cacheNames
=
{
"classPk"
},
unless
=
"#result == null"
)
public
ClassPK
getClassPk
(
final
Class
<?>
class1
)
{
final
ClassPK
classPk
=
classPkRepository
.
getByClassname
(
class1
.
getName
());
if
(
classPk
!=
null
)
{
...
...
auditlog/src/test/java/org/genesys/blocks/auditlog/test/ApplicationConfig.java
View file @
d6c0215d
...
...
@@ -24,6 +24,7 @@ import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import
org.springframework.cache.CacheManager
;
import
org.springframework.cache.annotation.EnableCaching
;
import
org.springframework.cache.concurrent.ConcurrentMapCache
;
import
org.springframework.cache.support.NoOpCacheManager
;
import
org.springframework.cache.support.SimpleCacheManager
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.ComponentScan
;
...
...
@@ -73,9 +74,7 @@ public class ApplicationConfig {
*/
@Bean
public
CacheManager
cacheManager
()
{
final
SimpleCacheManager
cacheManager
=
new
SimpleCacheManager
();
cacheManager
.
setCaches
(
Arrays
.
asList
(
new
ConcurrentMapCache
(
"default"
)));
return
cacheManager
;
return
new
NoOpCacheManager
();
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment