Source/NFX/ApplicationModel/Volatile/ObjectStoreService.cs
/// <summary>
/// Puts an object reference "value" into store identified by the "key".
/// The object is written in the provider when call count to this method equals to CheckOut()
/// </summary>
Puts an object reference "value" into store identified by the "key".
The object is written in the provider when call count to this method equals to CheckOut()
Puts an object reference " value " into store identified by the " key " . The object is written in the provider when call count to this method equals to CheckOut ()
public void CheckIn(Guid key, object value, int msTimeout = 0)
    {
      if (Status != ControlStatus.Active) return;
      if (value==null)
      {
        Delete(key);
        return;
      }
      var bucket = getBucket(key);
      ObjectStoreEntry entry = null;
      bool isnew = false;
      lock (bucket)
      {
        if (!bucket.TryGetValue(key, out entry))
        {
          isnew = true;
          entry = new ObjectStoreEntry();
          entry.Key = key;
          entry.Status = ObjectStoreEntryStatus.ChekedIn;
          entry.LastTime = App.LocalizedTime;
          entry.MsTimeout = msTimeout;
          entry.Value = value;
          bucket.Add(key, entry);
        }
      }
      if (!isnew)
        lock (entry)
        {
          if (entry.Status == ObjectStoreEntryStatus.Deleted) return;
          if (entry.CheckoutCount>0)
           entry.CheckoutCount--;
          if (entry.CheckoutCount==0)
            entry.Status = ObjectStoreEntryStatus.ChekedIn;
          entry.LastTime = App.LocalizedTime;
          entry.MsTimeout = msTimeout;
          entry.Value = value;
        }
    }
public void CheckIn ( Guid key , object value , int msTimeout = 0 ) { if ( Status != ControlStatus . Active ) return ; if ( value == null ) { Delete ( key ) ; return ; } var bucket = getBucket ( key ) ; ObjectStoreEntry entry = null ; bool isnew = false ; lock ( bucket ) { if ( ! bucket . TryGetValue ( key , out entry ) ) { isnew = true ; entry = new ObjectStoreEntry ( ) ; entry . Key = key ; entry . Status = ObjectStoreEntryStatus . ChekedIn ; entry . LastTime = App . LocalizedTime ; entry . MsTimeout = msTimeout ; entry . Value = value ; bucket . Add ( key , entry ) ; } } if ( ! isnew ) lock ( entry ) { if ( entry . Status == ObjectStoreEntryStatus . Deleted ) return ; if ( entry . CheckoutCount > 0 ) entry . CheckoutCount -- ; if ( entry . CheckoutCount == 0 ) entry . Status = ObjectStoreEntryStatus . ChekedIn ; entry . LastTime = App . LocalizedTime ; entry . MsTimeout = msTimeout ; entry . Value = value ; } }
Puts an object reference "value" into store identified by the "key".
Puts an object reference " value " into store identified by the " key " .
key
Guid
value
object
msTimeout
int