System\Net\Http\Headers\CacheControlHeaderValue.cs (52)
50private Flags _flags;
59private void SetTimeSpan(ref TimeSpan fieldRef, Flags flag, TimeSpan? value)
65private void SetFlag(Flags flag, bool value)
67Debug.Assert(sizeof(Flags) == sizeof(int));
73Interlocked.Or(ref Unsafe.As<Flags, int>(ref _flags), (int)flag);
77Interlocked.And(ref Unsafe.As<Flags, int>(ref _flags), (int)~flag);
83get => (_flags & Flags.NoCache) != 0;
84set => SetFlag(Flags.NoCache, value);
91get => (_flags & Flags.NoStore) != 0;
92set => SetFlag(Flags.NoStore, value);
97get => (_flags & Flags.MaxAgeHasValue) == 0 ? null : _maxAge;
98set => SetTimeSpan(ref _maxAge, Flags.MaxAgeHasValue, value);
103get => (_flags & Flags.SharedMaxAgeHasValue) == 0 ? null : _sharedMaxAge;
104set => SetTimeSpan(ref _sharedMaxAge, Flags.SharedMaxAgeHasValue, value);
109get => (_flags & Flags.MaxStale) != 0;
110set => SetFlag(Flags.MaxStale, value);
115get => (_flags & Flags.MaxStaleLimitHasValue) == 0 ? null : _maxStaleLimit;
116set => SetTimeSpan(ref _maxStaleLimit, Flags.MaxStaleLimitHasValue, value);
121get => (_flags & Flags.MinFreshHasValue) == 0 ? null : _minFresh;
122set => SetTimeSpan(ref _minFresh, Flags.MinFreshHasValue, value);
127get => (_flags & Flags.NoTransform) != 0;
128set => SetFlag(Flags.NoTransform, value);
133get => (_flags & Flags.OnlyIfCached) != 0;
134set => SetFlag(Flags.OnlyIfCached, value);
139get => (_flags & Flags.Public) != 0;
140set => SetFlag(Flags.Public, value);
145get => (_flags & Flags.Private) != 0;
146set => SetFlag(Flags.Private, value);
153get => (_flags & Flags.MustRevalidate) != 0;
154set => SetFlag(Flags.MustRevalidate, value);
159get => (_flags & Flags.ProxyRevalidate) != 0;
160set => SetFlag(Flags.ProxyRevalidate, value);
220if ((_flags & Flags.MaxAgeHasValue) != 0)
237if ((_flags & Flags.SharedMaxAgeHasValue) != 0)
257if ((_flags & Flags.MaxStaleLimitHasValue) != 0)
274if ((_flags & Flags.MinFreshHasValue) != 0)
407Flags flagsToSet = Flags.None;
413flagsToSet = Flags.NoCache;
418flagsToSet = Flags.NoStore;
422flagsToSet = Flags.MaxAgeHasValue;
427flagsToSet = Flags.MaxStale;
431flagsToSet = Flags.MaxStale | Flags.MaxStaleLimitHasValue;
436flagsToSet = Flags.MinFreshHasValue;
441flagsToSet = Flags.NoTransform;
445flagsToSet = Flags.OnlyIfCached;
449flagsToSet = Flags.Public;
453flagsToSet = Flags.Private;
458flagsToSet = Flags.MustRevalidate;
462flagsToSet = Flags.ProxyRevalidate;
466flagsToSet = Flags.SharedMaxAgeHasValue;