Write single key=value to redis with lookup_set_value
This commit is contained in:
parent
d0c4938e38
commit
69cddd64f7
@ -147,8 +147,6 @@ public class RedisLookupDataAdapter extends LookupDataAdapter {
|
||||
return LookupResult.empty();
|
||||
}
|
||||
return LookupResult.single(value);
|
||||
|
||||
//return LookupResult.single("coincoin");
|
||||
} catch (Exception e) {
|
||||
LOG.error("Redis GET request error for key <{}>", trimmedKey, e);
|
||||
redisGetRequestErrors.mark();
|
||||
@ -158,23 +156,27 @@ public class RedisLookupDataAdapter extends LookupDataAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
// This is deprecated, see setValue
|
||||
@Override
|
||||
public void set(Object key, Object value) {
|
||||
//throw new UnsupportedOperationException();
|
||||
LOG.warn("Entering Redis set function with {}={}", key.toString(), value.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LookupResult setValue(Object key, Object value) {
|
||||
final Timer.Context time = redisSetRequestTimer.time();
|
||||
try {
|
||||
final String result = this.commands.set(key.toString(), value.toString());
|
||||
if (!result.equals("OK")) {
|
||||
LOG.warn("Redis SET key <{}> to value <{}> returned {}", key, value, result);
|
||||
redisSetRequestErrors.mark();
|
||||
return;
|
||||
return LookupResult.empty();
|
||||
}
|
||||
return;
|
||||
return LookupResult.single(value.toString());
|
||||
} catch (Exception e) {
|
||||
LOG.error("Redis SET key <{}> to value <{}> returned an exception: {}", key, value, e);
|
||||
redisSetRequestErrors.mark();
|
||||
return;
|
||||
return LookupResult.empty();
|
||||
} finally {
|
||||
time.stop();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user