本文整理匯總了C#中ServiceStack.Redis.RedisClient.ZRem方法的典型用法代碼示例。如果您正苦於以下問題:C# RedisClient.ZRem方法的具體用法?C# RedisClient.ZRem怎麽用?C# RedisClient.ZRem使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ServiceStack.Redis.RedisClient
的用法示例。
在下文中一共展示了RedisClient.ZRem方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: DoUpdateChangeKey
private void DoUpdateChangeKey(RedisClient client, string setId, object keyByte, byte[] values, bool isHash, byte[] buffer)
{
string key = isHash
? Encoding.UTF8.GetString((byte[])keyByte)
: keyByte.ToString();
dynamic entity = null;
try
{
entity = CovertEntityObject(key, values);
CacheType cacheType = CacheType.None;
if (entity != null)
{
SchemaTable schema;
Type entityType = entity.GetType();
if (!EntitySchemaSet.TryGet(entityType, out schema))
{
EntitySchemaSet.InitSchema(entityType);
}
if (schema != null || EntitySchemaSet.TryGet(entityType, out schema))
{
cacheType = schema.CacheType;
}
if (cacheType != CacheType.None)
{
string redisKey = cacheType == CacheType.Dictionary
? key.Split('|')[0]
: key.Split('_')[0];
using (IDataSender sender = DataSyncManager.GetRedisSender(schema, redisKey))
{
sender.Send(entity);
}
}
}
}
catch (Exception ex)
{
TraceLog.WriteError("ChangeKey:{0} error:{1}", key, ex);
}
if (isHash)
{
client.HDel(setId, (byte[])keyByte);
}
else
{
client.ZRem(setId, buffer);
}
if (entity != null)
{
Type type = entity.GetType();
string entityKey = string.Format("{0},{1}", key, type.Assembly.GetName().Name);
client.HSet("__GLOBAL_SQL_CHANGE_KEYS_NEW", Encoding.UTF8.GetBytes(entityKey), new byte[] { 1 });
}
}
示例2: DoWriteToDb
private bool DoWriteToDb(RedisClient redisClient, byte[] buffer)
{
SqlStatement statement = null;
try
{
statement = ProtoBufUtils.Deserialize<SqlStatement>(buffer);
if (statement != null)
{
var dbProvider = DbConnectionProvider.CreateDbProvider("", statement.ProviderType, statement.ConnectionString);
if (dbProvider != null)
{
var paramList = ConvertParam(dbProvider, statement.Params);
dbProvider.ExecuteQuery(statement.CommandType, statement.CommandText, paramList);
redisClient.ZRem(_setId, buffer);
return true;
}
}
_errorCount++;
return false;
}
catch (Exception ex)
{
_errorCount++;
try
{
if (removeCheckBox.Checked)
{
redisClient.ZRem(_setId, buffer);
}
}
catch
{
}
if (statement != null)
{
try
{
msgListBox.Items.Add(string.Format("pos:{0}, error:{1}", _currentIndex, ex.Message));
TraceLog.WriteError("WriteToDb:{0}\r\n{1}\r\nParam:{2}",
ex.Message,
statement.CommandText,
GetParamToString(statement.Params));
}
catch
{
}
}
return false;
}
}