Skip to content
This repository was archived by the owner on Nov 20, 2018. It is now read-only.

Commit dccb3af

Browse files
committed
Don't clear cache when adding feature from factory
1 parent 364a712 commit dccb3af

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/Microsoft.AspNet.Http.Features/FeatureReferences.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,15 @@ public TFeature Fetch<TFeature, TState>(
3737
}
3838

3939
var feature = cached;
40-
if (feature == null)
40+
if (feature == null || cleared)
4141
{
4242
feature = Collection.Get<TFeature>();
4343
if (feature == null)
4444
{
4545
feature = factory(state);
4646

4747
Collection.Set(feature);
48-
if (!cleared)
49-
{
50-
Cache = default(TCache);
51-
}
48+
5249
Revision = Collection.Revision;
5350
}
5451
cached = feature;
@@ -59,4 +56,4 @@ public TFeature Fetch<TFeature, TState>(
5956
public TFeature Fetch<TFeature>(ref TFeature cached, Func<IFeatureCollection, TFeature> factory) =>
6057
Fetch(ref cached, Collection, factory);
6158
}
62-
}
59+
}

0 commit comments

Comments
 (0)