2020-03-02 00:00:44 +04:00
|
|
|
using System.Collections.Concurrent;
|
2020-03-03 14:11:51 +04:00
|
|
|
using Kruzya.TelegramBot.Core.Cache;
|
2020-03-02 00:00:44 +04:00
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
|
|
|
|
|
namespace Kruzya.TelegramBot.Core.Extensions
|
|
|
|
|
{
|
|
|
|
|
public static class StartupExtension
|
|
|
|
|
{
|
|
|
|
|
public static IServiceCollection AddQueue<T>(this IServiceCollection collection)
|
2020-03-02 17:07:26 +04:00
|
|
|
=> collection.AddSingleton<ConcurrentQueue<T>>();
|
2020-03-03 14:11:51 +04:00
|
|
|
|
|
|
|
|
public static IServiceCollection AddMemoryCache<TKey, TValue>(this IServiceCollection collection)
|
|
|
|
|
=> collection.AddSingleton<MemoryCache<TKey, TValue>>();
|
2020-03-02 00:00:44 +04:00
|
|
|
}
|
|
|
|
|
}
|