ServiceStack.Redis.RedisNativeClient.Set C# (CSharp) Method

Set() public method

public Set ( string key, byte value, bool exists, int expirySeconds, long expiryMs ) : bool
key string
value byte
exists bool
expirySeconds int
expiryMs long
return bool
        public bool Set(string key, byte[] value, bool exists, int expirySeconds = 0, long expiryMs = 0)
        {
            var entryExists = exists ? Commands.Xx : Commands.Nx;

            if (expirySeconds > 0)
                return SendExpectString(Commands.Set, key.ToUtf8Bytes(), value, Commands.Ex, expirySeconds.ToUtf8Bytes(), entryExists) == OK;
            if (expiryMs > 0)
                return SendExpectString(Commands.Set, key.ToUtf8Bytes(), value, Commands.Px, expiryMs.ToUtf8Bytes(), entryExists) == OK;

            return SendExpectString(Commands.Set, key.ToUtf8Bytes(), value, entryExists) == OK;
        }

Same methods

RedisNativeClient::Set ( byte key, byte value, int expirySeconds, long expiryMs ) : void
RedisNativeClient::Set ( string key, byte value ) : void
RedisNativeClient::Set ( string key, byte value, int expirySeconds, long expiryMs ) : void

Usage Example

        public void Benchmark_SET_raw_bytes_1k_ServiceStack()
        {
            var redis = new RedisNativeClient();

            Run("ServiceStack.Redis 1K", 1000,
                (i, bytes) => redis.Set("eitan" + i.ToString(), bytes));
        }
RedisNativeClient