CacheObject.java
709 Bytes
package com.yoho.search.cache.model;
import java.io.Serializable;
public class CacheObject implements Serializable{
private static final long serialVersionUID = -3949382156604252137L;
private Object object;
private long expireTime;// 过期秒数
public CacheObject(Object object,int expireInMinute) {
super();
this.object = object;
this.expireTime = System.currentTimeMillis() + expireInMinute * 60 * 1000L;
}
public Object getObject() {
return object;
}
public long getExpireTime() {
return expireTime;
}
public static void main(String[] args) {
long current = System.currentTimeMillis();
System.out.println(current);
System.out.println(current + 3000 * 60);
}
}