Ejemplo n.º 1
0
 public List <string> FuzzyFindIdsByCondition <T>(string property, string valuePattern)
     where T : IRedisModelBase
 {
     using (var Redis = RedisClientManager.GetReadOnlyClient())
     {
         return(Redis.GetUnionFromSets(KeyFuzzyFind(RedisKeyFactory.QueryKeyWithPropertyAndValue <T>(property, valuePattern)).ToArray()).ToList());
     }
 }
Ejemplo n.º 2
0
        public List <string> FindIdsByConditions <T>(List <KeyValuePair <string, string> > conditions)
            where T : IRedisModelBase
        {
            List <string> conditionSets = new List <string>();

            foreach (var c in conditions)
            {
                conditionSets.Add(RedisKeyFactory.QueryKeyWithPropertyAndValue <T>(c.Key, c.Value));
            }
            using (var Redis = RedisClientManager.GetReadOnlyClient())
            {
                return(Redis.GetIntersectFromSets(conditionSets.ToArray()).ToList());
            }
        }
Ejemplo n.º 3
0
        public void DoIndexBySet <T>(string idVal, string propertyName, string value, bool isRemoveIndex = false)
            where T : IRedisModelBase
        {
            string queryKey = RedisKeyFactory.QueryKeyWithPropertyAndValue <T>(propertyName, value);

            using (var Redis = RedisClientManager.GetClient())
            {
                if (isRemoveIndex)
                {
                    Redis.RemoveItemFromSet(queryKey, idVal);
                }
                else
                {
                    Redis.AddItemToSet(queryKey, idVal);
                }
            }
        }