add reset command + exists method for data source

This commit is contained in:
unurled 2024-02-29 15:29:56 +01:00
parent 9f33889604
commit 7cc9395cbc
Signed by: unurled
GPG key ID: FDBC9CBE1F82423F
6 changed files with 172 additions and 2 deletions

View file

@ -53,4 +53,11 @@ public interface DataHandler {
* @param key The key to remove the value from
*/
void remove(@NotNull String key);
/**
* Check if a key exists in the data source
* @param key The key to check
* @return If the key exists
*/
boolean exists(@NotNull String key);
}

View file

@ -94,4 +94,14 @@ public class Redis implements DataHandler {
public void remove(@NotNull String key) {
client.del(key);
}
/**
* Check if a key exists
* @param key The key to check
* @return If the key exists
*/
@Override
public boolean exists(@NotNull String key) {
return client.exists(key);
}
}