Example #1
0
        // Internal for unit testing
        internal MemoryCacheEntryOptions GetMemoryCacheEntryOptions(IEntryLink entryLink)
        {
            var options = new MemoryCacheEntryOptions();

            if (ExpiresOn != null)
            {
                options.SetAbsoluteExpiration(ExpiresOn.Value);
            }

            if (ExpiresAfter != null)
            {
                options.SetAbsoluteExpiration(ExpiresAfter.Value);
            }

            if (ExpiresSliding != null)
            {
                options.SetSlidingExpiration(ExpiresSliding.Value);
            }

            if (Priority != null)
            {
                options.SetPriority(Priority.Value);
            }

            options.AddEntryLink(entryLink);
            return(options);
        }
Example #2
0
        // Internal for unit testing
        internal MemoryCacheEntryOptions GetMemoryCacheEntryOptions(IEntryLink entryLink)
        {
            var options = new MemoryCacheEntryOptions();
            if (ExpiresOn != null)
            {
                options.SetAbsoluteExpiration(ExpiresOn.Value);
            }

            if (ExpiresAfter != null)
            {
                options.SetAbsoluteExpiration(ExpiresAfter.Value);
            }

            if (ExpiresSliding != null)
            {
                options.SetSlidingExpiration(ExpiresSliding.Value);
            }

            if (Priority != null)
            {
                options.SetPriority(Priority.Value);
            }

            options.AddEntryLink(entryLink);
            return options;
        }