Repository: microsoft/garnet
File: libs/server/Transaction/TxnKeyManager.cs (C#)

Code before:
            var key = respSession.GetCommandAsArgSlice(out success);
            if (!success) return -2;
            SaveKeyEntryToLock(key, isObject, type);
            SaveKeyArgSlice(key);
            return arg;
        }

        /// <summary>
        /// Returns a list of keys for commands: MGET, DEL, UNLINK
        /// </summary>
        private int ListKeys(int inputCount, bool isObject, LockType type)
        {
            for (int i = 0; i < inputCount; i++)
            {
                var key = respSession.GetCommandAsArgSlice(out bool success);
                if (!success) return -2;
                SaveKeyEntryToLock(key, isObject, type);
                SaveKeyArgSlice(key);
            }
            return inputCount;
        }

        /// <summary>
        /// Returns a list of keys for LMPOP command
        /// </summary>
        private int LMPOPKeys(int inputCount, bool isObject, LockType type)
        {
            var numKeysArg = respSession.GetCommandAsArgSlice(out bool success);
            if (!success) return -2;

            var numKeys = Convert.ToInt32(numKeysArg.ToString());

            for (int i = 0; i < numKeys; i++)
            {
                var key = respSession.GetCommandAsArgSlice(out success);
                if (!success) return -2;
                SaveKeyEntryToLock(key, isObject, type);
                SaveKeyArgSlice(key);
            }
            return numKeys;
        }

        /// <summary>
        /// Returns a list of keys for MSET commands
        /// </summary>
        private int MSETKeys(int inputCount, bool isObject, LockType type)
        {
            for (int i = 0; i < inputCount; i += 2)
            {
                var key = respSession.GetCommandAsArgSlice(out bool success);
                if (!success) return -2;

Review comment (suggestion):
This is actually useful for other commands besides LMPOP, since there are other commands that have this ```numKeys key [key...]``` syntax.
I would then make it an overload of ListObjectKeys without the inputCount parameter since it's unnecessary in this scenario.

Code after:
                respSession.GetCommandAsArgSlice(out success);
                if (!success) return -2;
            }
            var key = respSession.GetCommandAsArgSlice(out success);
            if (!success) return -2;
            SaveKeyEntryToLock(key, isObject, type);
            SaveKeyArgSlice(key);
            return arg;
        }

        /// <summary>
        /// Returns a list of keys for commands: MGET, DEL, UNLINK
        /// </summary>
        private int ListKeys(int inputCount, bool isObject, LockType type)
        {
            for (int i = 0; i < inputCount; i++)
            {
                var key = respSession.GetCommandAsArgSlice(out bool success);
                if (!success) return -2;
                SaveKeyEntryToLock(key, isObject, type);
                SaveKeyArgSlice(key);
            }
            return inputCount;
        }

        /// <summary>
        /// Returns a list of keys for LMPOP command
        /// </summary>
        private int ListKeys(bool isObject, LockType type)
        {
            var numKeysArg = respSession.GetCommandAsArgSlice(out bool success);
            if (!success) return -2;

            if (!NumUtils.TryParse(numKeysArg.ReadOnlySpan, out int numKeys)) return -2;

            for (int i = 0; i < numKeys; i++)
            {
                var key = respSession.GetCommandAsArgSlice(out success);
                if (!success) return -2;
                SaveKeyEntryToLock(key, isObject, type);
                SaveKeyArgSlice(key);
            }
            return numKeys;
        }

        /// <summary>
        /// Returns a list of keys for MSET commands
        /// </summary>
        private int MSETKeys(int inputCount, bool isObject, LockType type)
        {
            for (int i = 0; i < inputCount; i += 2)