This commit is contained in:
2025-02-28 18:36:49 +08:00
parent 79cba2ea7a
commit a2155976f3

View File

@@ -28,13 +28,20 @@ class Redis {
Future<String?> get(String key) async {
return await _command?.send_object(["GET", key]);
}
Future<bool> setWithExpiry(String key, String value, int ttlInSeconds) async {
var response = await _command
?.send_object(["SETEX", key, ttlInSeconds.toString(), value]);
return response == "OK";
}
}
class RedisConfig {
String host;
int port;
RedisConfig(
{required this.host,
this.port = 6379,});
RedisConfig({
required this.host,
this.port = 6379,
});
}