mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-10 16:46:19 +00:00
#1427 - QueryCache should be cleared, if one of a dependent bean is updated
Refactor on PostCommitProcessing with fixes for dependent table invalidation
This commit is contained in:
1 parent
9159cec36c
commit
ed566ca153
19 files changed
+262
-127
No files matched your search
@@ -25,6 +25,6 @@ class CacheChangeBeanUpdate implements CacheChange {
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
desc.cacheBeanUpdate(id, changes, updateNaturalKey, version);
|
||||
desc.cacheApplyBeanUpdate(id, changes, updateNaturalKey, version);
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,8 @@ public class CacheChangeSet {
|
||||
|
||||
private final Set<BeanDescriptor<?>> queryCaches = new HashSet<>();
|
||||
|
||||
private final Set<BeanDescriptor<?>> beanCaches = new HashSet<>();
|
||||
|
||||
private final Map<BeanDescriptor<?>, CacheChangeBeanRemove> beanRemoveMap = new HashMap<>();
|
||||
|
||||
private final Map<ManyKey, ManyChange> manyChangeMap = new HashMap<>();
|
||||
@@ -51,6 +53,9 @@ public class CacheChangeSet {
|
||||
for (BeanDescriptor<?> entry : queryCaches) {
|
||||
entry.clearQueryCache();
|
||||
}
|
||||
for (BeanDescriptor<?> entry : beanCaches) {
|
||||
entry.clearBeanCache();
|
||||
}
|
||||
for (CacheChange entry : entries) {
|
||||
entry.apply();
|
||||
}
|
||||
@@ -69,6 +74,13 @@ public class CacheChangeSet {
|
||||
touchedTables.add(descriptor.getBaseTable());
|
||||
}
|
||||
|
||||
/**
|
||||
* Add invalidation on a set of tables.
|
||||
*/
|
||||
public void addInvalidate(Set<String> tables) {
|
||||
touchedTables.addAll(tables);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an entry to clear a query cache.
|
||||
*/
|
||||
@@ -76,6 +88,13 @@ public class CacheChangeSet {
|
||||
queryCaches.add(descriptor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an entry to clear a bean cache.
|
||||
*/
|
||||
public void addClearBean(BeanDescriptor<?> descriptor) {
|
||||
beanCaches.add(descriptor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add many property clear.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user