コード例 #1
0
 /// <see cref="IFeatureStore.Delete{T}(VersionedDataKind{T}, string, int)"/>
 public void Delete <T>(VersionedDataKind <T> kind, string key, int version) where T : IVersionedData
 {
     try
     {
         RwLock.TryEnterWriteLock(RwLockMaxWaitMillis);
         IDictionary <string, IVersionedData> itemsOfKind;
         if (Items.TryGetValue(kind, out itemsOfKind))
         {
             IVersionedData item;
             if (!itemsOfKind.TryGetValue(key, out item) || item.Version < version)
             {
                 itemsOfKind[key] = kind.MakeDeletedItem(key, version);
             }
         }
     }
     finally
     {
         RwLock.ExitWriteLock();
     }
 }
コード例 #2
0
 /// <inheritdoc/>
 public void Delete <T>(VersionedDataKind <T> kind, string key, int version) where T : IVersionedData
 {
     lock (WriterLock)
     {
         ImmutableDictionary <string, IVersionedData> itemsOfKind;
         if (Items.TryGetValue(kind, out itemsOfKind))
         {
             IVersionedData item;
             if (!itemsOfKind.TryGetValue(key, out item) || item.Version < version)
             {
                 ImmutableDictionary <string, IVersionedData> newItemsOfKind = itemsOfKind.SetItem(key, kind.MakeDeletedItem(key, version));
                 Items = Items.SetItem(kind, newItemsOfKind);
             }
         }
     }
 }