本文整理汇总了C#中IDatabase.StringBitOperationAsync方法的典型用法代码示例。如果您正苦于以下问题:C# IDatabase.StringBitOperationAsync方法的具体用法?C# IDatabase.StringBitOperationAsync怎么用?C# IDatabase.StringBitOperationAsync使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDatabase
的用法示例。
在下文中一共展示了IDatabase.StringBitOperationAsync方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BitwiseNotAsync
/// <summary>
/// Perform a bitwise NOT operation on a key (containing a string value) and store the result in the destination
/// key.
/// </summary>
/// <param name="database">
/// The database where the query will be performed. This is passed so that we can reuse the same database to
/// perform multiple bitwise operations. Doing this with the same connection will guarantee that performance
/// is good.
/// </param>
/// <param name="destination">
/// The destination key where the result should be stored.
/// </param>
/// <param name="key">
/// The key where the data to be NOT'd is located.
/// </param>
/// <param name="expires">
/// An expiration lifetime.
/// </param>
/// <returns>
/// The size of the string stored in the destination key, that is equal to the size of the longest input string.
/// </returns>
/// <remarks>
/// http://redis.io/commands/bitop
/// </remarks>
public static Task<long> BitwiseNotAsync(IDatabase database, RedisKey destination, RedisKey key, TimeSpan expires)
{
Task<long> result = database
.StringBitOperationAsync(Bitwise.Not, destination, key);
database.KeyExpireAsync(destination, expires);
return result;
}
示例2: BitwiseXOrAsync
/// <summary>
/// Perform a bitwise XOR operation between multiple keys (containing string values) and store the result in the
/// destination key.
/// </summary>
/// <param name="database">
/// The database where the query will be performed. This is passed so that we can reuse the same database to
/// perform multiple bitwise operations. Doing this with the same connection will guarantee that performance
/// is good.
/// </param>
/// <param name="destination">
/// The destination key where the result should be stored.
/// </param>
/// <param name="keys">
/// The keys where the data to be XOR'd are located.
/// </param>
/// <returns>
/// The size of the string stored in the destination key, that is equal to the size of the longest input string.
/// </returns>
/// <remarks>
/// http://redis.io/commands/bitop
/// </remarks>
public static Task<long> BitwiseXOrAsync(IDatabase database, RedisKey destination, RedisKey[] keys)
{
Task<long> result = database
.StringBitOperationAsync(Bitwise.Xor, destination, keys);
return result;
}
示例3: BitwiseOrAsync
/// <summary>
/// Perform a bitwise OR operation between multiple keys (containing string values) and store the result in the
/// destination key.
/// </summary>
/// <param name="database">
/// The database where the query will be performed. This is passed so that we can reuse the same database to
/// perform multiple bitwise operations. Doing this with the same connection will guarantee that performance
/// is good.
/// </param>
/// <param name="destination">
/// The destination key where the result should be stored.
/// </param>
/// <param name="keys">
/// The keys where the data to be OR'd are located.
/// </param>
/// <param name="expire">
/// An expiration lifetime.
/// </param>
/// <returns>
/// The size of the string stored in the destination key, that is equal to the size of the longest input string.
/// </returns>
/// <remarks>
/// http://redis.io/commands/bitop
/// </remarks>
public static Task<long> BitwiseOrAsync(IDatabase database, RedisKey destination, RedisKey[] keys, TimeSpan expire)
{
Task<long> result = database
.StringBitOperationAsync(Bitwise.Or, destination, keys);
database.KeyExpireAsync(destination, expire);
return result;
}