Class GeneratedIdCache

java.lang.Object
io.permazen.core.util.GeneratedIdCache

@ThreadSafe public class GeneratedIdCache extends Object
Cache for randomly generated object IDs based on unique strings.

Instances are thread safe.

See Also:
  • Constructor Details

    • GeneratedIdCache

      public GeneratedIdCache()
  • Method Details

    • getGeneratedId

      public ObjId getGeneratedId(Transaction tx, String typeName, String string)
      Generate an object ID for the given object type name and string.

      If an ObjId has already been created for the specified typeName and string by this instance, it will be returned. Otherwise, a random ObjId for which no object exists in the specified Transaction is generated and returned.

      Parameters:
      tx - transaction from which to allocate new object IDs
      typeName - object type name
      string - unique string
      Returns:
      unique, unallocated object ID corresponding to typeName and string
      Throws:
      IllegalArgumentException - if any parameter is null
    • clear

      public void clear()
      Clear this instance.