tangled
alpha
login
or
join now
dunkirk.sh
/
cachet
0
fork
atom
a cache for slack profile pictures and emojis
0
fork
atom
overview
issues
pulls
pipelines
feat: add sqlite options for even faster performance
dunkirk.sh
2 months ago
3afe53b0
7f931006
verified
This commit was signed with the committer's
known signature
.
dunkirk.sh
SSH Key Fingerprint:
SHA256:DqcG0RXYExE26KiWo3VxJnsxswN1QNfTBvB+bdSpk80=
+26
1 changed file
expand all
collapse all
unified
split
src
cache.ts
+26
src/cache.ts
reviewed
···
372
372
this.defaultExpiration = defaultExpirationHours;
373
373
this.onEmojiExpired = onEmojiExpired;
374
374
375
375
+
// Optimize SQLite for performance
376
376
+
this.optimizeSQLite();
377
377
+
375
378
// Initialize type-safe analytics cache
376
379
this.typedAnalyticsCache = new AnalyticsCache();
377
380
···
382
385
383
386
// Run migrations
384
387
this.runMigrations();
388
388
+
}
389
389
+
390
390
+
/**
391
391
+
* Optimizes SQLite performance settings
392
392
+
* @private
393
393
+
*/
394
394
+
private optimizeSQLite() {
395
395
+
// Enable Write-Ahead Logging for better concurrency
396
396
+
this.db.run("PRAGMA journal_mode = WAL");
397
397
+
398
398
+
// NORMAL synchronous mode is faster and still safe with WAL
399
399
+
this.db.run("PRAGMA synchronous = NORMAL");
400
400
+
401
401
+
// Increase cache size to 64MB for better query performance
402
402
+
this.db.run("PRAGMA cache_size = -64000");
403
403
+
404
404
+
// Store temporary tables in memory
405
405
+
this.db.run("PRAGMA temp_store = MEMORY");
406
406
+
407
407
+
// Enable memory-mapped I/O for faster reads (256MB)
408
408
+
this.db.run("PRAGMA mmap_size = 268435456");
409
409
+
410
410
+
console.log("SQLite performance optimizations applied");
385
411
}
386
412
387
413
/**