/// <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)); }
/// <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)); }
/** <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); }
/** <inheritDoc /> */ public Task <int> GetSizeAsync(params CachePeekMode[] modes) { var modes0 = IgniteUtils.EncodePeekModes(modes); return(DoOutOpAsync <int>(CacheOp.SizeAsync, w => w.WriteInt(modes0))); }
/** <inheritdoc /> */ public IEnumerable <ICacheEntry <TK, TV> > GetLocalEntries(CachePeekMode[] peekModes) { return(new CacheEnumerable <TK, TV>(this, IgniteUtils.EncodePeekModes(peekModes))); }