mirror of
https://github.com/Nystik-gh/ignis.git
synced 2026-06-17 04:35:53 +00:00
refactor utility functions
This commit is contained in:
@@ -5,19 +5,14 @@
|
||||
// - 5-minute TTL per entry
|
||||
// - Entries kept until TTL expires (plugins may read the same file multiple times)
|
||||
|
||||
import { normalize } from "../util/path.js";
|
||||
|
||||
const MAX_SIZE = 200 * 1024 * 1024;
|
||||
const TTL_MS = 5 * 60 * 1000;
|
||||
|
||||
const cache = new Map(); // path -> { data, size, createdAt }
|
||||
let currentSize = 0;
|
||||
|
||||
function normalize(p) {
|
||||
return (p || "")
|
||||
.replace(/\\/g, "/")
|
||||
.replace(/^\/+/, "")
|
||||
.replace(/\/+$/, "");
|
||||
}
|
||||
|
||||
function evictExpired() {
|
||||
const now = Date.now();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user