Example #1
0
 @Override
 public void invalidateCache(CacheAccessBackDoor cacheAccess) {
   cacheAccess.removeRelationshipFromCache(getKey());
   /*
    * If isRecovered() then beforeUpdate is the correct one UNLESS this is the second time this command
    * is executed, where it might have been actually written out to disk so the fields are already -1. So
    * we still need to check.
    * If !isRecovered() then beforeUpdate is the same as record, so we are still ok.
    * We don't check for !inUse() though because that is implicit in the call of this method.
    * The above is a hand waiving proof that the conditions that lead to the patchDeletedRelationshipNodes()
    * in the if below are the same as in RelationshipCommand.execute() so it should be safe.
    */
   if (beforeUpdate.getFirstNode() != -1 || beforeUpdate.getSecondNode() != -1) {
     cacheAccess.patchDeletedRelationshipNodes(
         getKey(),
         beforeUpdate.getFirstNode(),
         beforeUpdate.getFirstNextRel(),
         beforeUpdate.getSecondNode(),
         beforeUpdate.getSecondNextRel());
   }
   if (record.getFirstNode() != -1 || record.getSecondNode() != -1) {
     cacheAccess.removeNodeFromCache(record.getFirstNode());
     cacheAccess.removeNodeFromCache(record.getSecondNode());
   }
 }
Example #2
0
 @Override
 public void invalidateCache(CacheAccessBackDoor cacheAccess) {
   long nodeId = this.getNodeId();
   long relId = this.getRelId();
   if (nodeId != -1) {
     cacheAccess.removeNodeFromCache(nodeId);
   } else if (relId != -1) {
     cacheAccess.removeRelationshipFromCache(relId);
   }
 }