-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_cache.js
More file actions
32 lines (27 loc) · 850 Bytes
/
check_cache.js
File metadata and controls
32 lines (27 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Simple script to check the current state of the project cache
import express from 'express';
import { _projectCache, getProjectMarketData } from './server/cache.js';
const app = express();
const port = 3001;
app.get('/dump-cache', (req, res) => {
const cacheEntries = {};
// Loop through all entries in the project cache
for (const [projectId, cacheEntry] of _projectCache.entries()) {
cacheEntries[projectId] = {
lastUpdated: cacheEntry.lastUpdated,
marketData: cacheEntry.marketData,
tokenHolders: {
count: cacheEntry.tokenHolders.holders.length
},
apiSuccess: cacheEntry.apiSuccess,
isNew: cacheEntry.isNew
};
}
res.json({
cacheEntries,
cacheSize: _projectCache.size
});
});
app.listen(port, () => {
console.log(`Cache dump server running on port ${port}`);
});