示例#1
0
 /// <summary>
 /// May flush memory data into either operation system memory or hard disk, and return message count and queue file size in bytes. Note the method only returns message count and queue file size in bytes if the option is oMemoryCached
 /// </summary>
 /// <param name="key">An ASCII string for identifying a queue at server side</param>
 /// <param name="f">A callback for tracking returning message count and queue file size in bytes</param>
 /// <param name="option">one of options, oMemoryCached, oSystemMemoryCached and oDiskCommitted</param>
 /// <param name="discarded">a callback for tracking cancel or socket closed event</param>
 /// <returns>true for sending the request successfully, and false for failure</returns>
 public virtual bool FlushQueue(byte[] key, DFlush f, tagOptimistic option, DDiscarded discarded)
 {
     return(SendRequest(idFlush, key, (int)option, (ar) =>
     {
         if (f != null)
         {
             ulong messageCount, fileSize;
             ar.UQueue.Load(out messageCount).Load(out fileSize);
             f((CAsyncQueue)ar.AsyncServiceHandler, messageCount, fileSize);
         }
         else
         {
             ar.UQueue.SetSize(0);
         }
     }, discarded, (DOnExceptionFromServer)null));
 }
示例#2
0
 /// <summary>
 /// May flush memory data into either operation system memory or hard disk, and return message count and queue file size in bytes. Note the method only returns message count and queue file size in bytes if the option is oMemoryCached
 /// </summary>
 /// <param name="key">An ASCII string for identifying a queue at server side</param>
 /// <param name="f">A callback for tracking returning message count and queue file size in bytes</param>
 /// <param name="option">one of options, oMemoryCached, oSystemMemoryCached and oDiskCommitted</param>
 /// <returns>true for sending the request successfully, and false for failure</returns>
 public bool FlushQueue(byte[] key, DFlush f, tagOptimistic option)
 {
     if (key == null)
         key = new byte[0];
     return SendRequest(idFlush, key, (int)option, (ar) =>
     {
         if (f != null)
         {
             ulong messageCount, fileSize;
             ar.Load(out messageCount).Load(out fileSize);
             f(messageCount, fileSize);
         }
         else
         {
             ar.UQueue.SetSize(0);
         }
     });
 }
示例#3
0
 /// <summary>
 /// Just get message count and queue file size in bytes only
 /// </summary>
 /// <param name="key">An ASCII string for identifying a queue at server side</param>
 /// <param name="f">A callback for tracking returning message count and queue file size in bytes</param>
 /// <returns>true for sending the request successfully, and false for failure</returns>
 public bool FlushQueue(byte[] key, DFlush f)
 {
     return FlushQueue(key, f, tagOptimistic.oMemoryCached);
 }
示例#4
0
 /// <summary>
 /// May flush memory data into either operation system memory or hard disk, and return message count and queue file size in bytes. Note the method only returns message count and queue file size in bytes if the option is oMemoryCached
 /// </summary>
 /// <param name="key">An ASCII string for identifying a queue at server side</param>
 /// <param name="f">A callback for tracking returning message count and queue file size in bytes</param>
 /// <param name="option">one of options, oMemoryCached, oSystemMemoryCached and oDiskCommitted</param>
 /// <returns>true for sending the request successfully, and false for failure</returns>
 public bool FlushQueue(byte[] key, DFlush f, tagOptimistic option)
 {
     return(FlushQueue(key, f, option, null));
 }