Exemple #1
0
        public IdHashTimeToMethod NewHashDateBindingForNow(ByteArray methodIdHash, Method methodModel)
        {
            var result = new IdHashTimeToMethod {
                Method = methodModel, MethodIdHash = methodIdHash.Bytes, Time = DateTime.Now
            };

            return(result);
        }
Exemple #2
0
 public void AddOrUpdate(IdHashTimeToMethod idhash)
 {
     if (!ValidMethodModel(idhash.Method))
     {
         return;
     }
     try
     {
         // assume no duplicates
         base.IdHashTimeToMethods.Add(idhash);
     }
     catch (Exception e)
     {
         if (this.trace)
         {
             Console.WriteLine("[cache] SqlCacheModel: AddOrUpdate IdHashTimeToMethod failed: {0}", e.Message);
         }
     }
 }
        public void AddOrUpdate(IdHashTimeToMethod idhash)
        {
            lock (this.idHashLock)
            {
                var datetime = idhash.Time;
                SortedList <DateTime, ByteArray> hashes;
                if (!this.methodHashFromId.TryGetValue(idhash.MethodIdHash, out hashes))
                {
                    this.methodHashFromId.Add(idhash.MethodIdHash, hashes = new SortedList <DateTime, ByteArray>());
                }
                else
                {
                    Contract.Assume(hashes != null, "we do not know the invariant on methodHashFromId");
                }
                Console.WriteLine("[cache] Adding an entry in the method cache model at time: {0}", datetime);

                hashes[datetime] = idhash.Method.Hash;
            }
        }
 public void AddOrUpdate(IdHashTimeToMethod idhash)
 {
     Contract.Requires(idhash != null);
     throw new NotImplementedException();
 }