All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.enodeframework.domain.AggregateCacheInfo Maven / Gradle / Ivy

There is a newer version: 1.1.10
Show newest version
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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy