Commit 9f242b14 authored by Riabokon Stanislav(EPAM)[GCP]'s avatar Riabokon Stanislav(EPAM)[GCP]
Browse files

Merge branch 'cache-path_endpoint' into 'master'

Added cache for PATH endpoint (GONRG-4141)

See merge request !139
parents f9eef68e d67e8a3c
Pipeline #91616 canceled with stages
in 7 seconds
......@@ -71,7 +71,7 @@ public class PartitionServiceImpl implements IPartitionService {
this.partitionPropertyEntityRepository.saveAll(partitionProperties);
PartitionInfo pi = getPartition(partitionId);
if (pi != null) {
if (Objects.nonNull(pi)) {
partitionListCache.clearAll();
}
......@@ -118,6 +118,9 @@ public class PartitionServiceImpl implements IPartitionService {
partitionProperties.add(entity);
}
this.partitionPropertyEntityRepository.saveAll(partitionProperties);
if (Objects.nonNull(partitionServiceCache.get(partitionId))) {
partitionServiceCache.delete(partitionId);
}
return getPartition(partitionId);
}
......@@ -126,13 +129,13 @@ public class PartitionServiceImpl implements IPartitionService {
public PartitionInfo getPartition(String partitionId) {
PartitionInfo pi = partitionServiceCache.get(partitionId);
if (pi == null) {
if (Objects.isNull(pi)) {
pi = getEncryptedPartition(partitionId);
for (Property property : pi.getProperties().values()) {
decryptPartitionPropertyIfNeeded(property);
}
if (pi != null) {
if (Objects.nonNull(pi)) {
partitionServiceCache.put(partitionId, pi);
}
}
......@@ -181,7 +184,7 @@ public class PartitionServiceImpl implements IPartitionService {
}
this.partitionPropertyEntityRepository.deleteByPartitionId(partitionId);
if (partitionServiceCache.get(partitionId) != null) {
if (Objects.nonNull(partitionServiceCache.get(partitionId))) {
partitionServiceCache.delete(partitionId);
}
partitionListCache.clearAll();
......@@ -192,7 +195,7 @@ public class PartitionServiceImpl implements IPartitionService {
public List<String> getAllPartitions() {
List<String> partitions = partitionListCache.get(PARTITION_LIST_KEY);
if (partitions == null) {
if (Objects.isNull(partitions)) {
List<String> allPartitions = this.partitionPropertyEntityRepository.getAllPartitions();
partitions = (allPartitions.isEmpty() ? Collections.emptyList() : allPartitions);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment