internal static StackExchange.Redis.SetOperation ToSE(this Enums.SetOperation op) { var res = StackExchange.Redis.SetOperation.Union; mapping.TryGetValue(op, out res); return(res); }
/// <summary> /// Perform set operations on SortedSet values /// Records the number of items in the destination set. /// </summary> /// <param name="destinationKey">the key of the destination sorted set.</param> /// <param name="sourceKeys">keys of all the source sorted sets.</param> /// <param name="weights">Use this to apply weights to the elements opon aggregation</param> /// <param name="op">Union/Intersect/Diff</param> /// <param name="aggregation">Aggregation funciton to apply on the elements that are "combined"</param> public void SortedSetOperation( string destinationKey, string[] sourceKeys, double[] weights = null, Enums.SetOperation op = Enums.SetOperation.Union, Enums.SetOperationAggregation aggregation = Enums.SetOperationAggregation.Sum) { Record( this.contextTransaction.SortedSetCombineAndStoreAsync( op.ToSE(), Key(destinationKey), sourceKeys.Select((k) => Key(k)).ToArray(), weights: weights, aggregate: aggregation.ToSE(), flags: commandFlags) ); }