예제 #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());
     }
 }
예제 #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());
            }
        }
예제 #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);
                }
            }
        }