コード例 #1
0
        /// <summary>
        /// The given callback will be fired after the cache entry is evicted from the cache.
        /// </summary>
        /// <param name="options"></param>
        /// <param name="callback"></param>
        public static MemoryCacheEntryOptions RegisterPostEvictionCallback(
            this MemoryCacheEntryOptions options,
            PostEvictionDelegate callback)
        {
            if (callback == null)
            {
                throw new ArgumentNullException(nameof(callback));
            }

            return(options.RegisterPostEvictionCallback(callback, state: null));
        }
コード例 #2
0
        /// <summary>
        /// The given callback will be fired after the cache entry is evicted from the cache.
        /// </summary>
        /// <param name="options">The <see cref="MemoryCacheEntryOptions{TKey}"/>.</param>
        /// <param name="callback">The callback to register for calling after an entry is evicted.</param>
        /// <returns>The <see cref="MemoryCacheEntryOptions{TKey}"/> so that additional calls can be chained.</returns>
        public static MemoryCacheEntryOptions <TKey> RegisterPostEvictionCallback <TKey>(
            this MemoryCacheEntryOptions <TKey> options,
            PostEvictionDelegate <TKey> callback)
            where TKey : notnull
        {
            if (callback == null)
            {
                throw new ArgumentNullException(nameof(callback));
            }

            return(options.RegisterPostEvictionCallback(callback, state: null));
        }