#1427 - Map all deleteByIds into a single CacheChangeBeanRemove and use bulk removeAll api to remove from cache

This commit is contained in:
rob bygrave
2018-06-19 01:34:28 +12:00
parent 43e95d81f6
commit 671d082ad3
6 changed files with 62 additions and 31 deletions
@@ -683,7 +683,7 @@ final class BeanDescriptorCacheHelp<T> {
/**
* Remove a bean from the cache given its Id.
*/
void beanCacheInvalidate(Collection<Object> ids) {
void beanCacheApplyInvalidate(Collection<Object> ids) {
if (beanCache != null) {
if (beanLog.isDebugEnabled()) {
beanLog.debug(" REMOVE {}({})", cacheName, ids);
@@ -695,21 +695,6 @@ final class BeanDescriptorCacheHelp<T> {
}
}
/**
* Remove a bean from the cache given its Id.
*/
void beanCacheRemove(Object id) {
if (beanCache != null) {
if (beanLog.isDebugEnabled()) {
beanLog.debug(" REMOVE {}({})", cacheName, id);
}
beanCache.remove(id);
}
for (BeanPropertyAssocOne<?> imported : propertiesOneImported) {
imported.cacheClear();
}
}
/**
* Returns true if it managed to populate/load the bean from the cache.
*/
@@ -740,12 +725,12 @@ final class BeanDescriptorCacheHelp<T> {
/**
* Add appropriate cache changes to support delete by id.
*/
void handleDelete(Object id, CacheChangeSet changeSet) {
void handleDeleteIds(Collection<Object> ids, CacheChangeSet changeSet) {
if (invalidateQueryCache) {
changeSet.addInvalidate(desc);
} else {
if (beanCache != null) {
changeSet.addBeanRemove(desc, id);
changeSet.addBeanRemoveMany(desc, ids);
}
cacheDeleteImported(true, null, changeSet);
}