Beispiel #1
0
 public override void GetValueHandler(StringRequestReader request, ValueResponseWriter response)
 {
     long md5 = MD5Utility.GetMD5(request.key);
     if (Global.LocalStorage.Contains(md5))
     {
         //the bucket exists, very likely the key is in the bucket
         using (var bucket = Global.LocalStorage.UseBucket(md5))
         {
             response.isFound = false;
             bucket.elements.ForEach(element_accessor =>
                 {
                     //make sure one of the element matches the key
                     if (element_accessor.key == request.key)
                     {
                         response.isFound = true;
                         response.value = element_accessor.value;
                         return;
                     }
                 });
             return;
         }
     }
     else
     {
         //no entry for this key exist
         response.isFound = false;
         return;
     }
 }
Beispiel #2
0
        public override void GetValueHandler(StringRequestReader request, ValueResponseWriter response)
        {
            long md5 = MD5Utility.GetMD5(request.key);

            if (Global.LocalStorage.Contains(md5))
            {
                //the bucket exists, very likely the key is in the bucket
                using (var bucket = Global.LocalStorage.UseBucket(md5))
                {
                    response.isFound = false;
                    bucket.elements.ForEach(element_accessor =>
                    {
                        //make sure one of the element matches the key
                        if (element_accessor.key == request.key)
                        {
                            response.isFound = true;
                            response.value   = element_accessor.value;
                            return;
                        }
                    });
                    return;
                }
            }
            else
            {
                //no entry for this key exist
                response.isFound = false;
                return;
            }
        }