[ 
https://issues.apache.org/jira/browse/IGNITE-4226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15869766#comment-15869766
 ] 

Andrey Novikov commented on IGNITE-4226:
----------------------------------------

Hi [~roman_s],

Sorry, it was my mistake: GridRedisSetCommandHandler#isNx and 
GridRedisSetCommandHandler#isXx can be replaced by 
IgniteUtils#containsStringCollection

You may define method in GridRedisRestCommandHandler like this:
{code}
/**
 * Retrieves long value from parameters list.
 *
 * @param key Key.
 * @param params Parameters list.
 * @param dfltVal Default value.
 * @return Long value from parameters list or {@code dfltVal} if null or not 
exists.
 * @throws GridRedisGenericException If parsing failed.
 */
@Nullable protected Long longValue(String key, List<String> params,
    Long dfltVal) throws IgniteCheckedException {
    assert key != null;

    Iterator<String> it = params.iterator();

    while (it.hasNext()) {
        String opt = it.next();

        if (key.equalsIgnoreCase(opt)) {
            if (it.hasNext()) {
                String val = it.next();

                try {
                    return Long.valueOf(val);
                }
                catch (NumberFormatException ignore) {
                    throw new GridRedisGenericException("Failed to parse 
parameter of Long type [" + key + "=" + val + "]");
                }
            }
            else
                throw new GridRedisGenericException("Missed value for 
parameter: " + key);
        }
    }
}
{code}
And remove parameters parsing from GridRedisSetCommandHandler#setExpire.

> Redis SET command should handle expirations
> -------------------------------------------
>
>                 Key: IGNITE-4226
>                 URL: https://issues.apache.org/jira/browse/IGNITE-4226
>             Project: Ignite
>          Issue Type: Sub-task
>    Affects Versions: 1.8
>            Reporter: Roman Shtykh
>            Assignee: Roman Shtykh
>              Labels: redis
>             Fix For: 2.0
>
>
> Handling EX and PX parameters of SET command.
> https://redis.io/commands/set



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to