From 7163042f1bdd0b7edf3f5b32ec2aa65bfdb4ff0b Mon Sep 17 00:00:00 2001 From: ayunami2000 Date: Sun, 17 Apr 2022 19:39:24 -0400 Subject: [PATCH] limit cache file size lol --- src/main/java/dev/plex/cache/FileCache.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/plex/cache/FileCache.java b/src/main/java/dev/plex/cache/FileCache.java index 6feb866..ad8f3b9 100644 --- a/src/main/java/dev/plex/cache/FileCache.java +++ b/src/main/java/dev/plex/cache/FileCache.java @@ -21,13 +21,13 @@ public class FileCache if (theItem == null) { 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 { cache.remove(theItem); theItem = new CacheItem(new File(path)); - cache.add(theItem); + if (theItem.file.length < 1048576) cache.add(theItem); } return theItem.file; }