diff --git a/build.gradle b/build.gradle
index 1c1b7de..c18e085 100644
--- a/build.gradle
+++ b/build.gradle
@@ -64,7 +64,7 @@ dependencies {
compile group: 'org.aspectj', name: 'aspectjweaver', version: '1.8.10'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.6'
compile group: 'org.springframework', name: 'spring-core', version: '4.3.10.RELEASE'
-
+ compile group: 'org.ahocorasick', name: 'ahocorasick', version: '0.4.0'
compile group: 'com.google.guava', name: 'guava', version: '20.0'
compile group: 'com.diffplug.durian', name: 'durian', version: '3.+'
compile group: 'io.zipkin.java', name: 'zipkin', version: '1.29.2'
diff --git a/helenus-core.iml b/helenus-core.iml
index be96637..1f3247f 100644
--- a/helenus-core.iml
+++ b/helenus-core.iml
@@ -35,6 +35,7 @@
+
diff --git a/pom.xml b/pom.xml
index 71feca8..8e4391b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -148,6 +148,12 @@
20.0
+
+ org.ahocorasick
+ ahocorasick
+ 0.4.0
+
+
io.zipkin.java
diff --git a/src/main/java/net/helenus/core/AbstractUnitOfWork.java b/src/main/java/net/helenus/core/AbstractUnitOfWork.java
index c621770..3d505dd 100644
--- a/src/main/java/net/helenus/core/AbstractUnitOfWork.java
+++ b/src/main/java/net/helenus/core/AbstractUnitOfWork.java
@@ -17,15 +17,22 @@ package net.helenus.core;
import com.diffplug.common.base.Errors;
import com.google.common.collect.TreeTraverser;
+import net.helenus.core.cache.EntityIdentifyingFacet;
+import net.helenus.support.Either;
+import org.ahocorasick.trie.Emit;
+import org.ahocorasick.trie.Trie;
+
import java.util.*;
+import java.util.stream.Collectors;
/** Encapsulates the concept of a "transaction" as a unit-of-work. */
-public abstract class AbstractUnitOfWork implements UnitOfWork, AutoCloseable {
+public abstract class AbstractUnitOfWork implements UnitOfWork, AutoCloseable {
private final List> nested = new ArrayList<>();
private final HelenusSession session;
private final AbstractUnitOfWork parent;
private List postCommit = new ArrayList();
- private final Map> cache = new HashMap>();
+ private final Map>> cache = new HashMap>>();
+ private Trie cacheIndex = Trie.builder().ignoreOverlaps().onlyWholeWordsWhiteSpaceSeparated().build();
private boolean aborted = false;
private boolean committed = false;
@@ -36,14 +43,15 @@ public abstract class AbstractUnitOfWork implements UnitOfW
this.parent = parent;
}
- public UnitOfWork addNestedUnitOfWork(UnitOfWork uow) {
+ @Override
+ public void addNestedUnitOfWork(UnitOfWork uow) {
synchronized (nested) {
nested.add((AbstractUnitOfWork) uow);
}
- return this;
}
- public UnitOfWork begin() {
+ @Override
+ public UnitOfWork begin() {
// log.record(txn::start)
return this;
}
@@ -56,20 +64,49 @@ public abstract class AbstractUnitOfWork implements UnitOfW
}
}
- public Set