16 |
lastupdate = android.os.SystemClock.elapsedRealtime(); |
lastupdate = android.os.SystemClock.elapsedRealtime(); |
17 |
} |
} |
18 |
|
|
19 |
|
public boolean isExpired(long now) { |
20 |
|
return ( (lastupdate+timeout) < now); |
21 |
|
} |
22 |
|
|
23 |
public long lastupdate; |
public long lastupdate; |
24 |
public T value; |
public T value; |
25 |
} |
} |
42 |
K key = it.next(); |
K key = it.next(); |
43 |
|
|
44 |
CacheItem<V> item = cache.get(key); |
CacheItem<V> item = cache.get(key); |
45 |
if ( (item.lastupdate+timeout) < now) { //item too old |
if ( item.isExpired(now)) { //item too old |
46 |
it.remove(); |
it.remove(); |
47 |
//Log.e("Purge", "removing"); |
//Log.e("Purge", "removing"); |
48 |
} |
} |
62 |
|
|
63 |
|
|
64 |
if (item != null) { |
if (item != null) { |
65 |
if ( (item.lastupdate+timeout) < now) { //item too old |
if ( item.isExpired(now) ) { //item too old |
66 |
return null; |
return null; |
67 |
} else { |
} else { |
68 |
return item.value; //item still good |
return item.value; //item still good |