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

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

package org.enodeframework.domain

import org.enodeframework.common.extensions.SystemClock
import java.util.*

/**
 * @author [email protected]
 */
class AggregateCacheInfo(var aggregateRoot: AggregateRoot) {
    private var lastUpdateTime: Date

    init {
        lastUpdateTime = Date()
    }

    fun updateAggregateRoot(aggregateRoot: AggregateRoot) {
        this.aggregateRoot = aggregateRoot
        lastUpdateTime = Date()
    }

    fun isExpired(timeoutSeconds: Int): Boolean {
        return (SystemClock.now() - lastUpdateTime.time) / 1000 >= timeoutSeconds
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy