1
|
package eu.dnetlib.miscutils.cache;
|
2
|
|
3
|
/**
|
4
|
* A cache element encapsulates a value and a number of cache specific parameters like the expiration time.
|
5
|
*
|
6
|
* @author marko
|
7
|
*
|
8
|
* @param <T>
|
9
|
* type of payload
|
10
|
*/
|
11
|
@Deprecated
|
12
|
public class CacheElement<T> {
|
13
|
private T value;
|
14
|
private int timeToLive;
|
15
|
private int timeToIdle;
|
16
|
private long creationTime;
|
17
|
|
18
|
/**
|
19
|
* reference to the underlying implementation specific element instance, for all other properties not exposed here.
|
20
|
*/
|
21
|
Object specificElement;
|
22
|
|
23
|
CacheElement(final T value) {
|
24
|
this.value = value;
|
25
|
}
|
26
|
|
27
|
CacheElement(final T value, final int timeToLive, final int timeToIdle) {
|
28
|
this.value = value;
|
29
|
this.timeToLive = timeToLive;
|
30
|
this.timeToIdle = timeToIdle;
|
31
|
}
|
32
|
|
33
|
public T getValue() {
|
34
|
return value;
|
35
|
}
|
36
|
|
37
|
public void setValue(final T value) {
|
38
|
this.value = value;
|
39
|
}
|
40
|
|
41
|
public Integer getTimeToLive() {
|
42
|
return timeToLive;
|
43
|
}
|
44
|
|
45
|
public void setTimeToLive(final Integer timeToLive) {
|
46
|
this.timeToLive = timeToLive;
|
47
|
}
|
48
|
|
49
|
public Integer getTimeToIdle() {
|
50
|
return timeToIdle;
|
51
|
}
|
52
|
|
53
|
public void setTimeToIdle(final Integer timeToIdle) {
|
54
|
this.timeToIdle = timeToIdle;
|
55
|
}
|
56
|
|
57
|
public Object getSpecificElement() {
|
58
|
return specificElement;
|
59
|
}
|
60
|
|
61
|
public void setSpecificElement(final Object specificElement) {
|
62
|
this.specificElement = specificElement;
|
63
|
}
|
64
|
|
65
|
public long getCreationTime() {
|
66
|
return creationTime;
|
67
|
}
|
68
|
|
69
|
public void setCreationTime(long creationTime) {
|
70
|
this.creationTime = creationTime;
|
71
|
}
|
72
|
|
73
|
}
|