示例#1
0
        /// <summary>
        /// Convenience wrapper: returns tuple instead of using out.
        /// </summary>
        private static Tuple <int, bool> EncodePeekModes(params CachePeekMode[] modes)
        {
            bool hasNativeNear;
            var  encoded = IgniteUtils.EncodePeekModes(modes, out hasNativeNear);

            return(Tuple.Create(encoded, hasNativeNear));
        }
示例#2
0
        /// <summary>
        /// Internal size routine.
        /// </summary>
        /// <param name="loc">Local flag.</param>
        /// <param name="modes">peek modes</param>
        /// <returns>Size.</returns>
        private int Size0(bool loc, params CachePeekMode[] modes)
        {
            var modes0 = IgniteUtils.EncodePeekModes(modes);

            var op = loc ? CacheOp.SizeLoc : CacheOp.Size;

            return((int)DoOutInOp((int)op, modes0));
        }
示例#3
0
        /** <inheritDoc /> */
        public bool TryLocalPeek(TK key, out TV value, params CachePeekMode[] modes)
        {
            IgniteArgumentCheck.NotNull(key, "key");

            var res = DoOutInOpX((int)CacheOp.Peek,
                                 w =>
            {
                w.WriteObjectDetached(key);
                w.WriteInt(IgniteUtils.EncodePeekModes(modes));
            },
                                 (s, r) => r == True ? new CacheResult <TV>(Unmarshal <TV>(s)) : new CacheResult <TV>(),
                                 _readException);

            value = res.Success ? res.Value : default(TV);

            return(res.Success);
        }
示例#4
0
        /** <inheritDoc /> */
        public Task <int> GetSizeAsync(params CachePeekMode[] modes)
        {
            var modes0 = IgniteUtils.EncodePeekModes(modes);

            return(DoOutOpAsync <int>(CacheOp.SizeAsync, w => w.WriteInt(modes0)));
        }
示例#5
0
 /** <inheritdoc /> */
 public IEnumerable <ICacheEntry <TK, TV> > GetLocalEntries(CachePeekMode[] peekModes)
 {
     return(new CacheEnumerable <TK, TV>(this, IgniteUtils.EncodePeekModes(peekModes)));
 }