Skip to content
Snippets Groups Projects
Commit 750e0211 authored by Alok Joshi's avatar Alok Joshi Committed by ethiraj krishnamanaidu
Browse files

fix list api cache not updating upon creation and deletion

parent 70835dc1
No related branches found
No related tags found
No related merge requests found
......@@ -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