deleteExpired static method
Delete all expired settings.
This is called automatically by the database when the app starts.
Parameters:
lazy: Whether to delete the expired settings in a lazy transaction. Defaults tofalse.
Implementation
static Future<void> deleteExpired({bool lazy = false}) async {
final db = await DB.instance();
final now = DateTime.now();
if (lazy) {
db.writeTxn(() async {
db.kVs.where().expiresAtLessThan(now).deleteAll();
});
} else {
await db.writeTxn(() async {
await db.kVs.where().expiresAtLessThan(now).deleteAll();
});
}
}