org.enodeframework.domain.AggregateCacheInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of enode Show documentation
Show all versions of enode Show documentation
The enodeframework core implementation.
package org.enodeframework.domain;
import java.util.Date;
/**
* @author [email protected]
*/
public class AggregateCacheInfo {
private IAggregateRoot aggregateRoot;
private Date lastUpdateTime;
public AggregateCacheInfo(IAggregateRoot aggregateRoot) {
this.aggregateRoot = aggregateRoot;
this.lastUpdateTime = new Date();
}
public void updateAggregateRoot(IAggregateRoot aggregateRoot) {
this.aggregateRoot = aggregateRoot;
this.lastUpdateTime = new Date();
}
public boolean isExpired(int timeoutSeconds) {
return ((System.currentTimeMillis() - lastUpdateTime.getTime())) / 1000 >= timeoutSeconds;
}
public IAggregateRoot getAggregateRoot() {
return aggregateRoot;
}
public void setAggregateRoot(IAggregateRoot aggregateRoot) {
this.aggregateRoot = aggregateRoot;
}
public Date getLastUpdateTime() {
return lastUpdateTime;
}
public void setLastUpdateTime(Date lastUpdateTime) {
this.lastUpdateTime = lastUpdateTime;
}
}