Example #1
0
 internal CacheExpirationActionProperties(CacheExpirationActionType actionType, CacheBehaviorSetting cacheBehavior, CacheLevel cacheType, TimeSpan?cacheDuration)
 {
     ActionType    = actionType;
     CacheBehavior = cacheBehavior;
     CacheType     = cacheType;
     CacheDuration = cacheDuration;
 }
Example #2
0
        internal static CacheExpirationActionProperties DeserializeCacheExpirationActionProperties(JsonElement element)
        {
            CacheExpirationActionType typeName      = default;
            CacheBehaviorSetting      cacheBehavior = default;
            CacheLevel           cacheType          = default;
            Optional <TimeSpan?> cacheDuration      = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("typeName"))
                {
                    typeName = new CacheExpirationActionType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("cacheBehavior"))
                {
                    cacheBehavior = new CacheBehaviorSetting(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("cacheType"))
                {
                    cacheType = new CacheLevel(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("cacheDuration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        cacheDuration = null;
                        continue;
                    }
                    cacheDuration = property.Value.GetTimeSpan("c");
                    continue;
                }
            }
            return(new CacheExpirationActionProperties(typeName, cacheBehavior, cacheType, Optional.ToNullable(cacheDuration)));
        }
Example #3
0
 public CacheExpirationActionProperties(CacheExpirationActionType actionType, CacheBehaviorSetting cacheBehavior, CacheLevel cacheType)
 {
     ActionType    = actionType;
     CacheBehavior = cacheBehavior;
     CacheType     = cacheType;
 }