Update SQLiteCache.cs

This commit is contained in:
ClemensFischer 2025-02-25 20:57:13 +01:00
parent 7d6bca3535
commit d1d15da1ea

View file

@ -197,9 +197,9 @@ namespace MapControl.Caching
private SQLiteCommand GetItemCommand(string key) private SQLiteCommand GetItemCommand(string key)
{ {
var command = new SQLiteCommand("select buffer from items where key = @key and expiration > @now", connection); var command = new SQLiteCommand("select buffer from items where key = @key and expiration > @exp", connection);
command.Parameters.AddWithValue("@key", key); command.Parameters.AddWithValue("@key", key);
command.Parameters.AddWithValue("@now", DateTimeOffset.UtcNow.Ticks); command.Parameters.AddWithValue("@exp", DateTimeOffset.UtcNow.Ticks);
return command; return command;
} }
@ -224,8 +224,8 @@ namespace MapControl.Caching
private SQLiteCommand DeleteExpiredItemCommand() private SQLiteCommand DeleteExpiredItemCommand()
{ {
var command = new SQLiteCommand("delete from items where expiration <= @now; select changes()", connection); var command = new SQLiteCommand("delete from items where expiration <= @exp; select changes()", connection);
command.Parameters.AddWithValue("@now", DateTimeOffset.UtcNow.Ticks); command.Parameters.AddWithValue("@exp", DateTimeOffset.UtcNow.Ticks);
return command; return command;
} }