A timed LRU cache. Items remain valid until they expire. TimedCache can simplify database caching.
TimedCache storyCache = new TimedCache(30, 60000); public Story getCurrentStory(String id) { Story story = (Story) storyCache.get(id); if (story == null) { story = DB.queryStoryDatabase(id); storyCache.put(id, story); } return story; }
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.