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:
parent
c7658647fc
commit
b980ea837b
3 changed files with 5 additions and 4 deletions
src/main/java/dev/plex/cache
4
src/main/java/dev/plex/cache/FileCache.java
vendored
4
src/main/java/dev/plex/cache/FileCache.java
vendored
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue