public CachedResource(Resource content) { this(content, currentTime()); } }
/** * Retrieve a resource * * @param key * @return The resource cached under the given key, or null if no resource is cached. */ public Resource get(String key) { CachedResource cached = cache.get(key); if (cached != null) { cache.remove(key); currentStorage -= cached.content.getSize(); if (cached.time + expireDelay < currentTime()) { return null; } else { return cached.content; } } return null; }