mirror of
https://github.com/plexusorg/Module-HTTPD.git
synced 2024-12-22 16:04:59 +00:00
limit cache file size lol
This commit is contained in:
parent
1ec17ce7e7
commit
7163042f1b
1 changed files with 2 additions and 2 deletions
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)
|
if (theItem == null)
|
||||||
{
|
{
|
||||||
theItem = new CacheItem(new File(path));
|
theItem = new CacheItem(new File(path));
|
||||||
cache.add(theItem);
|
if (theItem.file.length < 1048576) cache.add(theItem);
|
||||||
}
|
}
|
||||||
if (System.currentTimeMillis() - theItem.timestamp > 3 * 60 * 1000) // 3 minutes
|
if (System.currentTimeMillis() - theItem.timestamp > 3 * 60 * 1000) // 3 minutes
|
||||||
{
|
{
|
||||||
cache.remove(theItem);
|
cache.remove(theItem);
|
||||||
theItem = new CacheItem(new File(path));
|
theItem = new CacheItem(new File(path));
|
||||||
cache.add(theItem);
|
if (theItem.file.length < 1048576) cache.add(theItem);
|
||||||
}
|
}
|
||||||
return theItem.file;
|
return theItem.file;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue