Last active
June 20, 2025 06:56
-
-
Save antronic/4a13ae17aca46ddd8effa4f5b4cbc554 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let getCache = () => { | |
let maxCache = db.serverStatus().wiredTiger.cache['maximum bytes configured'] | |
let useCache = db.serverStatus().wiredTiger.cache['bytes currently in the cache'] | |
return { | |
maxCache: maxCache / 1024 / 1024, // Convert to MB | |
useCache: useCache / 1024 / 1024, // Convert to MB | |
usePercent: (useCache / maxCache * 100).toFixed(2) + '%', // Percentage of cache used | |
} | |
} | |
let interval = setInterval(() => console.log(getCache()), 1000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment