6 Replies Latest reply on Apr 14, 2016 1:59 AM by vdzhuvinov

    Implementing LDAP cache store, a few questions

    vdzhuvinov

      We're implementing the AdvancedLoadWriteStore SPI so to allow caching of LDAP directory entries in Infinispan and we have a few implementation questions:

       

      1. The write method is obviously called when a new entry needs to be persisted (with Map.put). LDAP however has two separate write operations - ADD to create a new entry, and MODIFY to update an existing entry. Our current strategy is to try ADD first, and if we get an error code that indicates there's already an entry for the given key, then we try a MODIFY. My questions whether we can use MarshalledEntry.getMetadata().created() as a hint to choose MODIFY first if the created timestamp is not -1 and is reasonably in the past? Our tests showed that the created timestamp is set when expiration / lifespan is set, otherwise it's given -1 for non-expiring and permanent entries? Is that a sensible strategy?
      2. Can implementations of MarshalledEntryFactory be considered thread-safe? That isn't immediately obvious from the JavaDocs and the source code.

       

      Thanks,

       

      Vladimir