Skip to content

Commit 4f2ca9a

Browse files
authored
Add a clear method to the internal LruCache.java
1 parent b83b043 commit 4f2ca9a

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

driver/src/main/java/oracle/nosql/driver/util/LruCache.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,19 @@ public void stop(boolean wait) {
227227
}
228228
}
229229

230+
/**
231+
* Removes all the entries from this cache. The cache will be empty after
232+
* this call returns.
233+
*/
234+
public void clear() {
235+
lock.lock();
236+
try {
237+
cacheMap.clear();
238+
} finally {
239+
lock.unlock();
240+
}
241+
}
242+
230243
private boolean isExpired(CacheEntry<V> entry) {
231244
final long now = System.currentTimeMillis();
232245

@@ -292,7 +305,7 @@ private class TimeBasedCleanupTask implements Runnable {
292305

293306
/**
294307
* Attempt to stop the background activity for the cleanup.
295-
* @param wait if true, the the method attempts to wait for the
308+
* @param wait if true, the method attempts to wait for the
296309
* background thread to finish background activity.
297310
*/
298311
void stop(boolean wait) {

0 commit comments

Comments
 (0)