Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0] ISPN-14738 RESP endpoint commands don't require previous value #10797

Merged
merged 1 commit into from
Apr 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class Resp3Handler extends Resp3AuthHandler {
private static final Log log = LogFactory.getLog(MethodHandles.lookup().lookupClass(), Log.class);
static final byte[] OK = "+OK\r\n".getBytes(StandardCharsets.US_ASCII);

protected AdvancedCache<byte[], byte[]> ignoreLoaderCache;
protected AdvancedCache<byte[], byte[]> ignorePreviousValueCache;

Resp3Handler(RespServer respServer) {
super(respServer);
Expand All @@ -40,7 +40,7 @@ public class Resp3Handler extends Resp3AuthHandler {
@Override
protected void setCache(AdvancedCache<byte[], byte[]> cache) {
super.setCache(cache);
ignoreLoaderCache = cache.withFlags(Flag.SKIP_CACHE_LOAD);
ignorePreviousValueCache = cache.withFlags(Flag.SKIP_CACHE_LOAD, Flag.IGNORE_RETURN_VALUES);
}

protected static final BiConsumer<byte[], ByteBufPool> GET_BICONSUMER = (innerValueBytes, alloc) -> {
Expand Down Expand Up @@ -97,7 +97,7 @@ protected CompletionStage<RespRequestHandler> actualHandleRequest(ChannelHandler
if (arguments.size() != 2) {
return stageToReturn(SetOperation.performOperation(cache, arguments), ctx, SET_BICONSUMER);
}
return stageToReturn(ignoreLoaderCache.putAsync(arguments.get(0), arguments.get(1)), ctx, OK_BICONSUMER);
return stageToReturn(ignorePreviousValueCache.putAsync(arguments.get(0), arguments.get(1)), ctx, OK_BICONSUMER);
case GET:
byte[] keyBytes = arguments.get(0);

Expand Down Expand Up @@ -137,7 +137,7 @@ protected CompletionStage<RespRequestHandler> actualHandleRequest(ChannelHandler
// TODO: should we return the # of subscribers on this node?
// We use expiration to remove the event values eventually while preventing them during high periods of
// updates
return stageToReturn(ignoreLoaderCache.putAsync(SubscriberHandler.keyToChannel(arguments.get(0)), arguments.get(1), 3, TimeUnit.SECONDS), ctx, (ignore, alloc) -> {
return stageToReturn(ignorePreviousValueCache.putAsync(SubscriberHandler.keyToChannel(arguments.get(0)), arguments.get(1), 3, TimeUnit.SECONDS), ctx, (ignore, alloc) -> {
stringToByteBuf(":0\r\n", alloc);
});
case SUBSCRIBE:
Expand Down