• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

alibaba / jetcache / #405

16 Apr 2024 05:58AM UTC coverage: 0.0% (-88.9%) from 88.866%
#405

push

areyouok
add encoding to fix coverage report

0 of 5353 relevant lines covered (0.0%)

0.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/jetcache-core/src/main/java/com/alicp/jetcache/CacheConfig.java
1
package com.alicp.jetcache;
2

3
import com.alicp.jetcache.anno.CacheConsts;
4

5
import java.time.Duration;
6
import java.util.ArrayList;
7
import java.util.List;
8
import java.util.function.Function;
9

10
/**
11
 * Created on 16/9/7.
12
 *
13
 * @author huangli
14
 */
15
public class CacheConfig<K, V> implements Cloneable {
×
16
    private long expireAfterWriteInMillis = CacheConsts.DEFAULT_EXPIRE * 1000L;
×
17
    private long expireAfterAccessInMillis = 0;
×
18
    private Function<K, Object> keyConvertor;
19

20
    private CacheLoader<K, V> loader;
21

22
    private List<CacheMonitor> monitors = new ArrayList<>();
×
23

24
    private boolean cacheNullValue = false;
×
25

26
    private RefreshPolicy refreshPolicy;
27

28
    private int tryLockUnlockCount = 2;
×
29

30
    private int tryLockInquiryCount = 1;
×
31

32
    private int tryLockLockCount = 2;
×
33

34
    private boolean cachePenetrationProtect = false;
×
35
    private Duration penetrationProtectTimeout = null;
×
36

37
    @Override
38
    public CacheConfig clone() {
39
        try {
40
            CacheConfig copy = (CacheConfig) super.clone();
×
41
            if (monitors != null) {
×
42
                copy.monitors = new ArrayList(this.monitors);
×
43
            }
44
            if (refreshPolicy != null) {
×
45
                copy.refreshPolicy = this.refreshPolicy.clone();
×
46
            }
47
            return copy;
×
48
        } catch (CloneNotSupportedException e) {
×
49
            throw new CacheException(e);
×
50
        }
51
    }
52

53
    public Function<K, Object> getKeyConvertor() {
54
        return keyConvertor;
×
55
    }
56

57
    public void setKeyConvertor(Function<K, Object> keyConvertor) {
58
        this.keyConvertor = keyConvertor;
×
59
    }
×
60

61
    public boolean isExpireAfterAccess() {
62
        return expireAfterAccessInMillis > 0;
×
63
    }
64

65
    public boolean isExpireAfterWrite() {
66
        return expireAfterWriteInMillis > 0;
×
67
    }
68

69
    @Deprecated
70
    public long getDefaultExpireInMillis() {
71
        return expireAfterWriteInMillis;
×
72
    }
73

74
    @Deprecated
75
    public void setDefaultExpireInMillis(long defaultExpireInMillis) {
76
        this.expireAfterWriteInMillis = defaultExpireInMillis;
×
77
    }
×
78

79
    public long getExpireAfterWriteInMillis() {
80
        return expireAfterWriteInMillis;
×
81
    }
82

83
    public void setExpireAfterWriteInMillis(long expireAfterWriteInMillis) {
84
        this.expireAfterWriteInMillis = expireAfterWriteInMillis;
×
85
    }
×
86

87
    public long getExpireAfterAccessInMillis() {
88
        return expireAfterAccessInMillis;
×
89
    }
90

91
    public void setExpireAfterAccessInMillis(long expireAfterAccessInMillis) {
92
        this.expireAfterAccessInMillis = expireAfterAccessInMillis;
×
93
    }
×
94

95
    public CacheLoader<K, V> getLoader() {
96
        return loader;
×
97
    }
98

99
    public void setLoader(CacheLoader<K, V> loader) {
100
        this.loader = loader;
×
101
    }
×
102

103
    public boolean isCacheNullValue() {
104
        return cacheNullValue;
×
105
    }
106

107
    public void setCacheNullValue(boolean cacheNullValue) {
108
        this.cacheNullValue = cacheNullValue;
×
109
    }
×
110

111
    public List<CacheMonitor> getMonitors() {
112
        return monitors;
×
113
    }
114

115
    public void setMonitors(List<CacheMonitor> monitors) {
116
        this.monitors = monitors;
×
117
    }
×
118

119
    public RefreshPolicy getRefreshPolicy() {
120
        return refreshPolicy;
×
121
    }
122

123
    public void setRefreshPolicy(RefreshPolicy refreshPolicy) {
124
        this.refreshPolicy = refreshPolicy;
×
125
    }
×
126

127
    public int getTryLockUnlockCount() {
128
        return tryLockUnlockCount;
×
129
    }
130

131
    public void setTryLockUnlockCount(int tryLockUnlockCount) {
132
        this.tryLockUnlockCount = tryLockUnlockCount;
×
133
    }
×
134

135
    public int getTryLockInquiryCount() {
136
        return tryLockInquiryCount;
×
137
    }
138

139
    public void setTryLockInquiryCount(int tryLockInquiryCount) {
140
        this.tryLockInquiryCount = tryLockInquiryCount;
×
141
    }
×
142

143
    public int getTryLockLockCount() {
144
        return tryLockLockCount;
×
145
    }
146

147
    public void setTryLockLockCount(int tryLockLockCount) {
148
        this.tryLockLockCount = tryLockLockCount;
×
149
    }
×
150

151
    public boolean isCachePenetrationProtect() {
152
        return cachePenetrationProtect;
×
153
    }
154

155
    public void setCachePenetrationProtect(boolean cachePenetrationProtect) {
156
        this.cachePenetrationProtect = cachePenetrationProtect;
×
157
    }
×
158

159
    public Duration getPenetrationProtectTimeout() {
160
        return penetrationProtectTimeout;
×
161
    }
162

163
    public void setPenetrationProtectTimeout(Duration penetrationProtectTimeout) {
164
        this.penetrationProtectTimeout = penetrationProtectTimeout;
×
165
    }
×
166
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc