class TimedAsyncCommand<K, V, T> extends AsyncCommand<K, V, T> {

    long encodedAtNs = -1;

    long completedAtNs = -1;

    public TimedAsyncCommand(RedisCommand<K, V, T> command) {
        super(command);
    }

    @Override
    public void encode(ByteBuf buf) {
        completedAtNs = -1;
        encodedAtNs = -1;

        super.encode(buf);
        encodedAtNs = System.nanoTime();
    }

    @Override
    public void complete() {
        completedAtNs = System.nanoTime();
        super.complete();
    }

    public long duration() {<FILL_FUNCTION_BODY>}

}

        if (completedAtNs == -1 || encodedAtNs == -1) {
            return -1;
        }
        return completedAtNs - encodedAtNs;
    
<methods>public void <init>(RedisCommand<K,V,T>) ,public boolean await(long, java.util.concurrent.TimeUnit) ,public boolean cancel(boolean) ,public void cancel() ,public void complete() ,public boolean completeExceptionally(java.lang.Throwable) ,public void encode(ByteBuf) ,public boolean equals(java.lang.Object) ,public CommandArgs<K,V> getArgs() ,public RedisCommand<K,V,T> getDelegate() ,public java.lang.String getError() ,public CommandOutput<K,V,T> getOutput() ,public io.lettuce.core.protocol.ProtocolKeyword getType() ,public int hashCode() ,public void onComplete(Consumer<? super T>) ,public void onComplete(BiConsumer<? super T,java.lang.Throwable>) ,public void setOutput(CommandOutput<K,V,T>) ,public java.lang.String toString() <variables>private static final AtomicIntegerFieldUpdater<AsyncCommand#RAW> COUNT_UPDATER,private final non-sealed RedisCommand<K,V,T> command,private volatile int count