### Question:
LRUCache2 { public synchronized void purge() { cache.clear(); } LRUCache2(int maxsize, long timeout);  LRUCache2(Environment environment, int maxsize, long timeout); synchronized void put(Object key, Object value); Object get(Object key); synchronized void purge(); synchronized void purge(String[] patterns); int size();  }### Answer:
@Test public void testPurge() { TestEnvironment env = new TestEnvironment(); LRUCache2 cache = new LRUCache2(env, 100, 15000); env.time = 1000; cache.put("key1", "string1"); cache.put("key2", "string2"); cache.put("key3", "string3"); assertNotNull(cache.get("key1")); assertNotNull(cache.get("key2")); assertNotNull(cache.get("key3")); cache.purge(new String[] {"key1", "key2"}); assertEquals(1, cache.size()); cache.purge(); assertEquals(0, cache.size()); }