/** * Flushes all documents in the cache that have not been touched for the * specified number of milliseconds. */ public void flush(int staleTimeout) { Collection<DatabaseDocument<T>> docs = cache.removeStale(staleTimeout); if (docs.size() > 0) { logger.debug("Flushing " + docs.size() + " out of " + (docs.size() + cache.getSize()) + " documents from cache"); } for (DatabaseDocument<T> d : docs) { d.removeFetchedBy(CACHE_TAG); writer.update(d); } }