MCPcopy Index your code
hub / github.com/wyouflf/xUtils3 / get

Method get

xutils/src/main/java/org/xutils/cache/LruDiskCache.java:87–123  ·  view source on GitHub ↗
(String key)

Source from the content-addressed store, hash-verified

85 }
86
87 public DiskCacheEntity get(String key) {
88 if (!available || TextUtils.isEmpty(key)) return null;
89
90 DiskCacheEntity result = null;
91 try {
92 result = this.cacheDb.selector(DiskCacheEntity.class)
93 .where("key", "=", key).findFirst();
94 } catch (Throwable ex) {
95 LogUtil.e(ex.getMessage(), ex);
96 }
97
98 if (result != null) {
99
100 if (result.getExpires() < System.currentTimeMillis()) {
101 return null;
102 }
103
104 { // update hint & lastAccess...
105 final DiskCacheEntity finalResult = result;
106 trimExecutor.execute(new Runnable() {
107 @Override
108 public void run() {
109 finalResult.setHits(finalResult.getHits() + 1);
110 finalResult.setLastAccess(System.currentTimeMillis());
111 try {
112 cacheDb.update(finalResult, "hits", "lastAccess");
113 } catch (Throwable ex) {
114 LogUtil.e(ex.getMessage(), ex);
115 }
116 }
117 });
118 }
119
120 }
121
122 return result;
123 }
124
125 public void put(DiskCacheEntity entity) {
126 if (!available

Callers 1

getDiskCacheFileMethod · 0.95

Calls 8

eMethod · 0.95
getExpiresMethod · 0.95
isEmptyMethod · 0.80
getMessageMethod · 0.80
executeMethod · 0.80
findFirstMethod · 0.65
selectorMethod · 0.65
whereMethod · 0.45

Tested by

no test coverage detected