Fixed locator caching scope 61/4961/3
authorJan Srnicek <[email protected]>
Tue, 31 Jan 2017 16:36:23 +0000 (17:36 +0100)
committerMarek Gradzki <[email protected]>
Thu, 2 Feb 2017 07:02:30 +0000 (07:02 +0000)
must be cached per locator set
(same as ipv4 addresses under interfaces)

Change-Id: I1e2828a1ba4d4d20c99a995e281fe0b6726465fb
Signed-off-by: Jan Srnicek <[email protected]>
lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/InterfaceCustomizer.java

index 202bf93..7baf92a 100755 (executable)
@@ -18,6 +18,7 @@ package io.fd.hc2vpp.lisp.translate.read;
 
 
 import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableSet;
 import io.fd.hc2vpp.common.translate.util.FutureJVppCustomizer;
 import io.fd.hc2vpp.common.translate.util.NamingContext;
 import io.fd.hc2vpp.lisp.translate.read.dump.executor.params.LocatorDumpParams;
@@ -30,6 +31,7 @@ import io.fd.honeycomb.translate.spi.read.Initialized;
 import io.fd.honeycomb.translate.spi.read.InitializingListReaderCustomizer;
 import io.fd.honeycomb.translate.util.RWUtils;
 import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
+import io.fd.honeycomb.translate.util.read.cache.TypeAwareIdentifierCacheKeyFactory;
 import io.fd.vpp.jvpp.core.dto.LispLocatorDetails;
 import io.fd.vpp.jvpp.core.dto.LispLocatorDetailsReplyDump;
 import io.fd.vpp.jvpp.core.future.FutureJVppCore;
@@ -71,7 +73,8 @@ public class InterfaceCustomizer
         this.dumpCacheManager =
                 new DumpCacheManager.DumpCacheManagerBuilder<LispLocatorDetailsReplyDump, LocatorDumpParams>()
                         .withExecutor(createLocatorDumpExecutor(futureJvpp))
-                        .acceptOnly(LispLocatorDetailsReplyDump.class)
+                        // must be cached per locator set
+                        .withCacheKeyFactory(new TypeAwareIdentifierCacheKeyFactory(LispLocatorDetailsReplyDump.class, ImmutableSet.of(LocatorSet.class)))
                         .build();
     }