Optimize singleton

This commit is contained in:
Andrea Cavalli 2022-03-20 14:45:48 +01:00
parent de5be6564e
commit e34e1e5852

View File

@ -106,6 +106,11 @@ public class DatabaseSingleton<U> extends ResourceSupport<DatabaseStage<U>, Data
.handle(this::deserializeValue);
}
@Override
public Mono<Void> set(U value) {
return singleton.set(Mono.fromCallable(() -> serializeValue(value)));
}
@Override
public Mono<U> setAndGetPrevious(U value) {
return Flux
@ -168,6 +173,11 @@ public class DatabaseSingleton<U> extends ResourceSupport<DatabaseStage<U>, Data
}));
}
@Override
public Mono<Void> clear() {
return singleton.set(Mono.empty());
}
@Override
public Mono<U> clearAndGetPrevious() {
return Flux