2023-05-30 23:41:37 -05:00
|
|
|
package noppes.npcs.client;
|
|
|
|
|
|
2023-05-31 00:56:15 -05:00
|
|
|
import noppes.npcs.client.renderer.ImageData;
|
2023-05-30 23:41:37 -05:00
|
|
|
import noppes.npcs.util.CacheHashMap;
|
|
|
|
|
|
2023-05-31 00:56:15 -05:00
|
|
|
public class ClientCacheHandler {
|
2023-05-31 00:35:57 -05:00
|
|
|
private static final CacheHashMap<String, CacheHashMap.CachedObject<ImageData>> imageDataCache = new CacheHashMap<>(10*60*1000);
|
2023-05-30 23:41:37 -05:00
|
|
|
|
|
|
|
|
public static ImageData getImageData(String directory) {
|
2023-05-31 00:35:57 -05:00
|
|
|
synchronized (imageDataCache) {
|
|
|
|
|
if (!imageDataCache.containsKey(directory)) {
|
|
|
|
|
imageDataCache.put(directory, new CacheHashMap.CachedObject<>(new ImageData(directory)));
|
|
|
|
|
}
|
|
|
|
|
return imageDataCache.get(directory).getObject();
|
2023-05-30 23:41:37 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|