Skip to content
Snippets Groups Projects
Commit 05a9a67a authored by ethiraj krishnamanaidu's avatar ethiraj krishnamanaidu
Browse files

Merge branch 'fix_list_cache' into 'master'

fix list api cache not updating upon creation and deletion

See merge request !31
parents 70835dc1 750e0211
No related branches found
No related tags found
1 merge request!31fix list api cache not updating upon creation and deletion
Pipeline #21048 passed
......@@ -50,6 +50,7 @@ public class CachedPartitionServiceImpl implements IPartitionService {
if (pi != null) {
partitionServiceCache.put(partitionId, partitionInfo);
partitionListCache.clearAll();
}
return pi;
......@@ -86,6 +87,7 @@ public class CachedPartitionServiceImpl implements IPartitionService {
if (partitionService.deletePartition(partitionId)) {
if (partitionServiceCache.get(partitionId) != null) {
partitionServiceCache.delete(partitionId);
partitionListCache.clearAll();
}
return true;
......
......@@ -52,11 +52,11 @@ public class CachedPartitionServiceImplTest {
PartitionInfo retPi = PartitionInfo.builder().build();
when(partitionServiceImpl.createPartition(partId, newPi)).thenReturn(retPi);
cachedPartitionServiceImpl.createPartition(partId, newPi);
verify(partitionServiceImpl, times(1)).createPartition(partId, newPi);
verify(partitionServiceCache, times(1)).put(partId, retPi);
verify(partitionListCache, times(1)).clearAll();
}
@Test
......@@ -71,6 +71,7 @@ public class CachedPartitionServiceImplTest {
verify(partitionServiceImpl, times(1)).createPartition(partId, newPi);
verify(partitionServiceCache, times(0)).put(any(), any());
verify(partitionListCache, times(0)).clearAll();
verify(partitionServiceCache, times(1)).get(any());
}
......@@ -131,6 +132,7 @@ public class CachedPartitionServiceImplTest {
verify(partitionServiceImpl, times(1)).deletePartition(partId);
verify(partitionServiceCache, times(1)).delete(partId);
verify(partitionServiceCache, times(1)).get(partId);
verify(partitionListCache, times(1)).clearAll();
}
@Test
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment