shikeying
2024-01-11 3b67e947e36133e2a40eb2737b15ea375e157ea0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package com.walker.cache;
 
import java.io.Serializable;
 
/**
 * <p/>可缓存对象抽象
 * <p/>系统对于缓存数据统一封装,此接口通常是系统内部使用,对客户端不可见
 * @author MikeShi
 * @date 2012-7-5
 *
 */
public interface Cachable extends Serializable {
 
    /**
     * 返回缓存对象的key
     * @return
     * @date 2012-7-5
     */
    String getKey();
    
    /**
     * 设置缓存对象的key,此key不可重复
     * @param key
     * @date 2012-7-5
     */
    void setKey(String key);
    
    /**
     * 返回缓存对象实际的值
     * @return
     * @date 2012-7-5
     */
    Object getValue();
    
    /**
     * 设置缓存对象实际的值
     * @param value
     * @date 2012-7-5
     */
    void setValue(Object value);
    
    /**
     * 返回对象被使用的次数
     * @return
     * @date 2012-7-5
     */
    int getHit();
    
    /**
     * 
     * 对象访问计数,每调用一次计数器加一
     * @date 2012-7-5
     */
    void hit();
    
    /**
     * 返回对象最近的时间戳
     * @return
     * @date 2012-7-5
     */
    long getTimeStamp();
    
    /**
     * 设置对象时间戳
     * @param currentMillisecond:以毫秒为基数
     * @date 2012-7-5
     */
    void setTimeStamp(long currentMillisecond);
    
    /**
     * 缓存数据是否过期
     * @param currentMillis:当前毫秒时间
     * @param timeOut:设置的过期毫秒数
     * @return
     * @date 2012-7-5
     */
    boolean isExpired(long timeOut, long currentMillis);
}