Skip to content

Commit

Permalink
feat: added config to disable attempt to update before insert in cache (
Browse files Browse the repository at this point in the history
  • Loading branch information
Milton-Ch committed Jul 15, 2022
1 parent 6df2e42 commit d9a07ff
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ public void create() {
// CouchbaseEntryManagerFactory.PERSISTENCE_TYPE
skipRemoveBeforePut = "couchbase".equals(persistenceType);
attemptUpdateBeforeInsert = "sql".equals(persistenceType);
if (cacheConfiguration.getNativePersistenceConfiguration().isDisableAttemptUpdateBeforeInsert()) {
attemptUpdateBeforeInsert = false;
}

log.info("Created NATIVE_PERSISTENCE cache provider. `baseDn`: " + baseDn);
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public class NativePersistenceConfiguration implements Serializable {
@XmlElement(name = "deleteExpiredOnGetRequest")
private boolean deleteExpiredOnGetRequest = false;

@XmlElement(name = "disableAttemptUpdateBeforeInsert")
private boolean disableAttemptUpdateBeforeInsert = false;

@JsonIgnore
private String baseDn;

Expand Down Expand Up @@ -53,7 +56,15 @@ public void setDeleteExpiredOnGetRequest(boolean deleteExpiredOnGetRequest) {
this.deleteExpiredOnGetRequest = deleteExpiredOnGetRequest;
}

public String getBaseDn() {
public boolean isDisableAttemptUpdateBeforeInsert() {
return disableAttemptUpdateBeforeInsert;
}

public void setDisableAttemptUpdateBeforeInsert(boolean disableAttemptUpdateBeforeInsert) {
this.disableAttemptUpdateBeforeInsert = disableAttemptUpdateBeforeInsert;
}

public String getBaseDn() {
return baseDn;
}

Expand All @@ -64,6 +75,8 @@ public void setBaseDn(String baseDn) {
@Override
public String toString() {
return "NativePersistenceConfiguration [defaultPutExpiration=" + defaultPutExpiration + ", defaultCleanupBatchSize="
+ defaultCleanupBatchSize + ", deleteExpiredOnGetRequest=" + deleteExpiredOnGetRequest + ", baseDn=" + baseDn + "]";
+ defaultCleanupBatchSize + ", deleteExpiredOnGetRequest=" + deleteExpiredOnGetRequest
+ ", disableAttemptUpdateBeforeInsert=" + disableAttemptUpdateBeforeInsert
+ ", baseDn=" + baseDn + "]";
}
}

0 comments on commit d9a07ff

Please sign in to comment.