Beispiel #1
0
        public static Task <TValue> GetAsyncX <TValue>(RedisDictionary <string, object> _dictionary, string key, Func <string, TValue> onAdd = null)
        {
            var result = _dictionary.GetOrAdd(key, (keyname) =>
            {
                var value = default(TValue);
                if (onAdd != null)
                {
                    value = onAdd.Invoke(keyname);
                }

                return(value);
            });

            var xxx = _dictionary.ValueSerializer.Deserialize <TValue>(result);

            return(Task.FromResult(xxx));
        }