Пример #1
0
        /** <inheritDoc /> */
        public Task <IDictionary <TK, ICacheEntryProcessorResult <TRes> > > InvokeAllAsync <TArg, TRes>(IEnumerable <TK> keys,
                                                                                                        ICacheEntryProcessor <TK, TV, TArg, TRes> processor, TArg arg)
        {
            AsyncInstance.InvokeAll(keys, processor, arg);

            return(AsyncInstance.GetTask(CacheOp.InvokeAll, reader => ReadInvokeAllResults <TRes>(reader.Stream)));
        }
Пример #2
0
        /** <inheritDoc /> */
        public Task <CacheResult <TV> > TryGetAsync(TK key)
        {
            IgniteArgumentCheck.NotNull(key, "key");

            AsyncInstance.Get(key);

            return(AsyncInstance.GetTask(CacheOp.Get, GetCacheResult));
        }
Пример #3
0
        /** <inheritDoc /> */
        public Task <TV> GetAsync(TK key)
        {
            AsyncInstance.Get(key);

            return(AsyncInstance.GetTask(CacheOp.Get, reader =>
            {
                if (reader != null)
                {
                    return reader.ReadObject <TV>();
                }

                throw GetKeyNotFoundException();
            }));
        }
Пример #4
0
        /** <inheritDoc /> */
        public Task <TRes> InvokeAsync <TArg, TRes>(TK key, ICacheEntryProcessor <TK, TV, TArg, TRes> processor, TArg arg)
        {
            AsyncInstance.Invoke(key, processor, arg);

            return(AsyncInstance.GetTask(CacheOp.Invoke, r =>
            {
                if (r == null)
                {
                    return default(TRes);
                }

                var hasError = r.ReadBoolean();

                if (hasError)
                {
                    throw ReadException(r.Stream);
                }

                return r.ReadObject <TRes>();
            }));
        }
Пример #5
0
        /** <inheritDoc /> */
        public Task ClearAsync(TK key)
        {
            AsyncInstance.Clear(key);

            return(AsyncInstance.GetTask(CacheOp.Clear));
        }
Пример #6
0
        /** <inheritDoc /> */
        public Task ClearAsync()
        {
            AsyncInstance.Clear();

            return(AsyncInstance.GetTask());
        }
Пример #7
0
        /** <inheritDoc /> */
        public Task PutAllAsync(IDictionary <TK, TV> vals)
        {
            AsyncInstance.PutAll(vals);

            return(AsyncInstance.GetTask(CacheOp.PutAll));
        }
Пример #8
0
        /** <inheritDoc /> */
        public Task <bool> ContainsKeyAsync(TK key)
        {
            AsyncInstance.ContainsKey(key);

            return(AsyncInstance.GetTask <bool>(CacheOp.ContainsKey));
        }
Пример #9
0
        /** <inheritDoc /> */
        public Task RemoveAllAsync()
        {
            AsyncInstance.RemoveAll();

            return(AsyncInstance.GetTask());
        }
Пример #10
0
        /** <inheritDoc /> */
        public Task <bool> RemoveAsync(TK key, TV val)
        {
            AsyncInstance.Remove(key, val);

            return(AsyncInstance.GetTask <bool>(CacheOp.RemoveBool));
        }
Пример #11
0
        /** <inheritDoc /> */
        public Task <CacheResult <TV> > GetAndRemoveAsync(TK key)
        {
            AsyncInstance.GetAndRemove(key);

            return(AsyncInstance.GetTask(CacheOp.GetAndRemove, GetCacheResult));
        }
Пример #12
0
        /** <inheritDoc /> */
        public Task <CacheResult <TV> > GetAndReplaceAsync(TK key, TV val)
        {
            AsyncInstance.GetAndReplace(key, val);

            return(AsyncInstance.GetTask(CacheOp.GetAndReplace, GetCacheResult));
        }
Пример #13
0
        /** <inheritDoc /> */
        public Task PutAsync(TK key, TV val)
        {
            AsyncInstance.Put(key, val);

            return(AsyncInstance.GetTask(CacheOp.Put));
        }
Пример #14
0
        /** <inheritDoc /> */
        public Task <IDictionary <TK, TV> > GetAllAsync(IEnumerable <TK> keys)
        {
            AsyncInstance.GetAll(keys);

            return(AsyncInstance.GetTask(CacheOp.GetAll, r => r == null ? null : ReadGetAllDictionary(r)));
        }
Пример #15
0
        /** <inheritDoc /> */
        public Task <bool> ContainsKeysAsync(IEnumerable <TK> keys)
        {
            AsyncInstance.ContainsKeys(keys);

            return(AsyncInstance.GetTask <bool>(CacheOp.ContainsKeys));
        }
Пример #16
0
        /** <inheritDoc /> */
        public Task ClearAllAsync(IEnumerable <TK> keys)
        {
            AsyncInstance.ClearAll(keys);

            return(AsyncInstance.GetTask(CacheOp.ClearAll));
        }
Пример #17
0
        /** <inheritDoc /> */
        public Task <bool> RemoveAsync(TK key)
        {
            AsyncInstance.Remove(key);

            return(AsyncInstance.GetTask <bool>(CacheOp.RemoveObj));
        }
Пример #18
0
        /** <inheritDoc /> */
        public Task <bool> PutIfAbsentAsync(TK key, TV val)
        {
            AsyncInstance.PutIfAbsent(key, val);

            return(AsyncInstance.GetTask <bool>(CacheOp.PutIfAbsent));
        }
Пример #19
0
        /** <inheritDoc /> */
        public Task RemoveAllAsync(IEnumerable <TK> keys)
        {
            AsyncInstance.RemoveAll(keys);

            return(AsyncInstance.GetTask(CacheOp.RemoveAll));
        }
Пример #20
0
        /** <inheritDoc /> */
        public Task <CacheResult <TV> > GetAndPutIfAbsentAsync(TK key, TV val)
        {
            AsyncInstance.GetAndPutIfAbsent(key, val);

            return(AsyncInstance.GetTask(CacheOp.GetAndPutIfAbsent, GetCacheResult));
        }
Пример #21
0
        /** <inheritDoc /> */
        public Task <int> GetSizeAsync(params CachePeekMode[] modes)
        {
            AsyncInstance.GetSize(modes);

            return(AsyncInstance.GetTask <int>());
        }
Пример #22
0
        /** <inheritDoc /> */
        public Task <bool> ReplaceAsync(TK key, TV val)
        {
            AsyncInstance.Replace(key, val);

            return(AsyncInstance.GetTask <bool>(CacheOp.Replace2));
        }
Пример #23
0
        /** <inheritDoc /> */
        public Task <bool> ReplaceAsync(TK key, TV oldVal, TV newVal)
        {
            AsyncInstance.Replace(key, oldVal, newVal);

            return(AsyncInstance.GetTask <bool>(CacheOp.Replace3));
        }
Пример #24
0
        /** <inheritDoc /> */
        public Task LocalLoadCacheAsync(ICacheEntryFilter <TK, TV> p, params object[] args)
        {
            AsyncInstance.LocalLoadCache(p, args);

            return(AsyncInstance.GetTask(CacheOp.LocLoadCache));
        }