Skip to content

Commit

Permalink
Cache should do entry update instead of remove/insert when DB is SQL #5
Browse files Browse the repository at this point in the history
  • Loading branch information
yurem committed Mar 9, 2021
1 parent d8c82d3 commit ebc5dab
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,12 @@ private void putImpl(String key, Object object, Date creationDate, int expiratio
}
}

if (e.getCause() instanceof SearchException) { // on lookup error, try to persist new entry
if (attemptUpdateBeforeInsert) {
try {
entryManager.persist(entity);
return;
} catch (Exception ex) {
log.error("Failed to retry put entry, key: " + originalKey + ", hashedKey: " + key + ", message: " + ex.getMessage(), ex);
}
if (attemptUpdateBeforeInsert) {
try {
entryManager.persist(entity);
return;
} catch (Exception ex) {
log.error("Failed to retry put entry, key: " + originalKey + ", hashedKey: " + key + ", message: " + ex.getMessage(), ex);
}
}

Expand Down

0 comments on commit ebc5dab

Please sign in to comment.