src/tiny.js
/**
	 * Clear out expired records from the 3 tables
	 */
Clear out expired records from the 3 tables
Clear out expired records from the 3 tables
gc() {
		const now = getTime();
		let nrDeleted = 0;
		const table = this.table;
		Object.entries(table).forEach(([k, v]) => {
			if (v && v.timeout < now) {
				delete this.forward[v.encoded];
				delete this.reverse[v.plain];
				delete table[k];
				nrDeleted++;
			}
		});	
		console.log(`Records freed: ${nrDeleted}`);
	}
gc ( ) { const now = getTime ( ) ; let nrDeleted = 0 ; const table = this . table ; Object . entries ( table ) . forEach ( ( [ k , v ] ) => { if ( v && v . timeout < now ) { delete this . forward [ v . encoded ] ; delete this . reverse [ v . plain ] ; delete table [ k ] ; nrDeleted ++ ; } } ) ; console . log ( ` ${ nrDeleted } ` ) ; }
Clear out expired records from the 3 tables
Clear out expired records from the 3 tables