1
0
Fork 0
mirror of https://github.com/plexusorg/Module-HTTPD.git synced 2025-06-22 23:30:23 +00:00

improve cache file size check

This commit is contained in:
ayunami2000 2022-04-17 19:54:10 -04:00
parent c7658647fc
commit b980ea837b
3 changed files with 5 additions and 4 deletions
src/main/java/dev/plex/cache

View file

@ -21,13 +21,13 @@ public class FileCache
if (theItem == null)
{
theItem = new CacheItem(new File(path));
if (theItem.file.length < 1048576) cache.add(theItem);
if (theItem.file != null) cache.add(theItem);
}
if (System.currentTimeMillis() - theItem.timestamp > 3 * 60 * 1000) // 3 minutes
{
cache.remove(theItem);
theItem = new CacheItem(new File(path));
if (theItem.file.length < 1048576) cache.add(theItem);
if (theItem.file != null) cache.add(theItem);
}
return theItem.file;
}