• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IMemoryCache类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IMemoryCache的典型用法代码示例。如果您正苦于以下问题:C# IMemoryCache类的具体用法?C# IMemoryCache怎么用?C# IMemoryCache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IMemoryCache类属于命名空间,在下文中一共展示了IMemoryCache类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: InitializeENodeFramework

        static void InitializeENodeFramework()
        {
            var setting = new ConfigurationSetting
            {
                SqlDefaultConnectionString = ConfigurationManager.AppSettings["connectionString"],
                EnableGroupCommitEvent = false
            };
            var assemblies = new[]
            {
                Assembly.Load("NoteSample.Domain"),
                Assembly.Load("NoteSample.CommandHandlers"),
                Assembly.Load("NoteSample.Commands"),
                Assembly.GetExecutingAssembly()
            };
            _configuration = ECommonConfiguration
                .Create()
                .UseAutofac()
                .RegisterCommonComponents()
                .UseLog4Net()
                .UseJsonNet()
                .RegisterUnhandledExceptionHandler()
                .CreateENode(setting)
                .RegisterENodeComponents()
                .UseSqlServerEventStore()
                .RegisterBusinessComponents(assemblies)
                .InitializeBusinessAssemblies(assemblies)
                .UseEQueue()
                .StartEQueue();

            _commandService = ObjectContainer.Resolve<ICommandService>();
            _memoryCache = ObjectContainer.Resolve<IMemoryCache>();
        }
开发者ID:ivivisoft,项目名称:enode,代码行数:32,代码来源:Program.cs


示例2: HomeController

 public HomeController(IConfigurationRoot configuration, IOptions<OtherSettings> otherSettings, ILogger<HomeController> logger, IMemoryCache memoryCache)
 {
     _configuration = configuration;
     _otherSettings = otherSettings.Value;
     _logger = logger;
     _memoryCache = memoryCache;
 }
开发者ID:niros2,项目名称:PublicRepo,代码行数:7,代码来源:HomeController.cs


示例3: DefaultCommandExecutor

        public DefaultCommandExecutor(
            IProcessingCommandCache processingCommandCache,
            ICommandAsyncResultManager commandAsyncResultManager,
            ICommandHandlerProvider commandHandlerProvider,
            IAggregateRootTypeProvider aggregateRootTypeProvider,
            IMemoryCache memoryCache,
            IRepository repository,
            IRetryCommandService retryCommandService,
            IEventStore eventStore,
            IEventPublisher eventPublisher,
            IEventPersistenceSynchronizerProvider eventPersistenceSynchronizerProvider,
            ICommandContext commandContext,
            ILoggerFactory loggerFactory)
        {
            _processingCommandCache = processingCommandCache;
            _commandAsyncResultManager = commandAsyncResultManager;
            _commandHandlerProvider = commandHandlerProvider;
            _aggregateRootTypeProvider = aggregateRootTypeProvider;
            _memoryCache = memoryCache;
            _repository = repository;
            _retryCommandService = retryCommandService;
            _eventStore = eventStore;
            _eventPublisher = eventPublisher;
            _eventPersistenceSynchronizerProvider = eventPersistenceSynchronizerProvider;
            _commandContext = commandContext;
            _trackingContext = commandContext as ITrackingContext;
            _logger = loggerFactory.Create(GetType().Name);

            if (_trackingContext == null)
            {
                throw new Exception("command context must also implement ITrackingContext interface.");
            }
        }
开发者ID:hjlfmy,项目名称:enode,代码行数:33,代码来源:DefaultCommandExecutor.cs


示例4: DefaultCommitEventService

 /// <summary>Parameterized constructor.
 /// </summary>
 /// <param name="waitingCommandService"></param>
 /// <param name="aggregateRootTypeCodeProvider"></param>
 /// <param name="aggregateRootFactory"></param>
 /// <param name="eventStreamConvertService"></param>
 /// <param name="eventSourcingService"></param>
 /// <param name="memoryCache"></param>
 /// <param name="aggregateStorage"></param>
 /// <param name="retryCommandService"></param>
 /// <param name="eventStore"></param>
 /// <param name="eventPublisher"></param>
 /// <param name="actionExecutionService"></param>
 /// <param name="eventSynchronizerProvider"></param>
 /// <param name="loggerFactory"></param>
 public DefaultCommitEventService(
     IWaitingCommandService waitingCommandService,
     IAggregateRootTypeCodeProvider aggregateRootTypeCodeProvider,
     IAggregateRootFactory aggregateRootFactory,
     IEventStreamConvertService eventStreamConvertService,
     IEventSourcingService eventSourcingService,
     IMemoryCache memoryCache,
     IAggregateStorage aggregateStorage,
     IRetryCommandService retryCommandService,
     IEventStore eventStore,
     IEventPublisher eventPublisher,
     IActionExecutionService actionExecutionService,
     IEventSynchronizerProvider eventSynchronizerProvider,
     ILoggerFactory loggerFactory)
 {
     _waitingCommandService = waitingCommandService;
     _aggregateRootTypeCodeProvider = aggregateRootTypeCodeProvider;
     _aggregateRootFactory = aggregateRootFactory;
     _eventStreamConvertService = eventStreamConvertService;
     _eventSourcingService = eventSourcingService;
     _memoryCache = memoryCache;
     _aggregateStorage = aggregateStorage;
     _retryCommandService = retryCommandService;
     _eventStore = eventStore;
     _eventPublisher = eventPublisher;
     _actionExecutionService = actionExecutionService;
     _eventSynchronizerProvider = eventSynchronizerProvider;
     _logger = loggerFactory.Create(GetType().Name);
 }
开发者ID:key-value,项目名称:enode,代码行数:44,代码来源:DefaultCommitEventService.cs


示例5: DefaultEventService

 public DefaultEventService(
     IJsonSerializer jsonSerializer,
     IScheduleService scheduleService,
     ITypeNameProvider typeNameProvider,
     IMemoryCache memoryCache,
     IAggregateRootFactory aggregateRootFactory,
     IAggregateStorage aggregateStorage,
     IEventStore eventStore,
     IMessagePublisher<DomainEventStreamMessage> domainEventPublisher,
     IOHelper ioHelper,
     ILoggerFactory loggerFactory)
 {
     _eventMailboxDict = new ConcurrentDictionary<string, EventMailBox>();
     _ioHelper = ioHelper;
     _jsonSerializer = jsonSerializer;
     _scheduleService = scheduleService;
     _typeNameProvider = typeNameProvider;
     _memoryCache = memoryCache;
     _aggregateRootFactory = aggregateRootFactory;
     _aggregateStorage = aggregateStorage;
     _eventStore = eventStore;
     _domainEventPublisher = domainEventPublisher;
     _logger = loggerFactory.Create(GetType().FullName);
     _batchSize = ENodeConfiguration.Instance.Setting.EventMailBoxPersistenceMaxBatchSize;
 }
开发者ID:ulswww,项目名称:enode,代码行数:25,代码来源:DefaultEventService.cs


示例6: CategoryController

		public CategoryController(IGanoolService ganool, IMemoryCache cache, IOptions<Settings> options)
	    {
			setting = options.Value;
			this.ganool = ganool;
			this.ganool.SiteUrl = BaseUrl;
			this.cache = cache;
	    }
开发者ID:fakhrulhilal,项目名称:web-crawler,代码行数:7,代码来源:CategoryController.cs


示例7: TokenHelper

        public TokenHelper(IMemoryCache cache)
        {
            if (cache == null) throw new ArgumentNullException(nameof(cache), $"{nameof(cache)} cannot be null");

            _cache = cache;
            _client = new HttpClient();
        }
开发者ID:digipolisantwerp,项目名称:serviceagents_aspnetcore,代码行数:7,代码来源:TokenHelper.cs


示例8: ProductsService

 public ProductsService(
     IMemoryCache memoryCache,
     ISignalTokenProviderService<Product> tokenProviderService)
 {
     _memoryCache = memoryCache;
     _tokenProviderService = tokenProviderService;
 }
开发者ID:cemalshukriev,项目名称:Mvc,代码行数:7,代码来源:ProductsService.cs


示例9: XmlBlogRepository

 public XmlBlogRepository(IHostingEnvironment env,
                             IMemoryCache memoryCache,
                             ILoggerFactory loggerFactory)
     : base(env, memoryCache)
 {
     Logger = loggerFactory.CreateLogger<XmlBlogRepository>();
 }
开发者ID:cnurse,项目名称:Naif.Blog,代码行数:7,代码来源:XmlBlogRepository.cs


示例10: QRCodeMiddleware

 public QRCodeMiddleware(RequestDelegate next, IQRCodeGenerator generator, IMemoryCache cache, ILogger<QRCodeMiddleware> logger)
 {
     this.next = next;
     this.logger = logger;
     this.generator = generator;
     this.cache = cache;
 }
开发者ID:r15h1,项目名称:qrcodr,代码行数:7,代码来源:QRCodeMiddleware.cs


示例11: PriodicallyReadKey

        private void PriodicallyReadKey(IMemoryCache cache, TimeSpan interval)
        {
            Task.Run(async () =>
            {
                while (true)
                {
                    await Task.Delay(interval);

                    if (Random.Next(3) == 0) // 1/3 chance
                    {
                        // Allow values to expire due to sliding refresh.
                        Console.WriteLine("Read skipped, random choice.");
                    }
                    else
                    {
                        Console.Write("Reading...");
                        object result;
                        if(!cache.TryGetValue(Key, out result))
                        {
                            result = cache.Set(Key, "B", _cacheEntryOptions);
                        }
                        Console.WriteLine("Read: " + (result ?? "(null)"));
                    }
                }
            });
        }
开发者ID:TerabyteX,项目名称:Caching,代码行数:26,代码来源:Program.cs


示例12: DefaultCleanAggregateService

 public DefaultCleanAggregateService(IMemoryCache memoryCache, IScheduleService scheduleService)
 {
     TimeoutSeconds = ENodeConfiguration.Instance.Setting.AggregateRootMaxInactiveSeconds;
     _memoryCache = memoryCache;
     _scheduleService = scheduleService;
     _scheduleService.StartTask("CleanAggregates", Clean, 1000, ENodeConfiguration.Instance.Setting.ScanExpiredAggregateIntervalMilliseconds);
 }
开发者ID:ulswww,项目名称:enode,代码行数:7,代码来源:DefaultCleanAggregateService.cs


示例13: InMemoryStorage

 public InMemoryStorage()
 {
     var builder = new ServiceCollection();
     builder.AddMemoryCache();
     var provider = builder.BuildServiceProvider();
     _memoryCache = (IMemoryCache)provider.GetService(typeof(IMemoryCache));
 }
开发者ID:yaozhenfa,项目名称:WebAPIContrib.Core,代码行数:7,代码来源:InMemoryStorage.cs


示例14: SecurityController

 public SecurityController(IMemoryCache cache, ICacheFactoryStore cacheFactoryStore, ToracGolfContext dbContext, IOptions<AppSettings> configuration, ILogger<SecurityController> logger)
 {
     DbContext = dbContext;
     Cache = cache;
     CacheFactory = cacheFactoryStore;
     Configuration = configuration;
     Logger = logger;
 }
开发者ID:dibiancoj,项目名称:ToracGolf,代码行数:8,代码来源:SecurityController.cs


示例15: SettingsController

 public SettingsController(IMemoryCache cache, ICacheFactoryStore cacheFactoryStore, ToracGolfContext dbContext, IAntiforgery antiforgery, IOptions<AppSettings> configuration)
 {
     DbContext = dbContext;
     Cache = cache;
     CacheFactory = cacheFactoryStore;
     Antiforgery = antiforgery;
     Configuration = configuration;
 }
开发者ID:dibiancoj,项目名称:ToracGolf,代码行数:8,代码来源:SettingsController.cs


示例16: FileBlogRepository

 protected FileBlogRepository(IHostingEnvironment env, IMemoryCache memoryCache)
 {
     MemoryCache = memoryCache;
     PostsCacheKey = "{0}_posts";
     PostsFolder = Path.Combine("{0}", "posts", "{1}");
     _filesFolder = "/posts/{1}/files/";
     RootFolder = env.WebRootPath;
 }
开发者ID:cnurse,项目名称:Naif.Blog,代码行数:8,代码来源:FileBlogRepository.cs


示例17: DataMiddleware

 public DataMiddleware(RequestDelegate next,
     IMemoryCache memCache,
     IService<Employee> serv)
 {
     _next = next;
     _MemoryCache = memCache;
     _service = serv;
 }
开发者ID:dotnetcurry,项目名称:asp.net-mvc-inmemory-caching,代码行数:8,代码来源:DataMiddleware.cs


示例18: WebDataResolver

 public WebDataResolver(
     IHostingEnvironment hostingEnvironment,
     IMemoryCache memoryCache,
     IOptions<StatusPageOptions> options)
 {
     this.hostingEnvironment = hostingEnvironment;
     this.memoryCache = memoryCache;
     this.options = options.Value;
 }
开发者ID:pdelvo,项目名称:StyleCopAnalyzersStatus,代码行数:9,代码来源:WebDataResolver.cs


示例19: FeatureHash

 public FeatureHash(
     IFeatureManager featureManager,
     IMemoryCache memoryCache,
     ISignal signal)
 {
     _memoryCache = memoryCache;
     _featureManager = featureManager;
     _signal = signal;
 }
开发者ID:huoxudong125,项目名称:Orchard2,代码行数:9,代码来源:FeatureHash.cs


示例20: SiteService

 public SiteService(
     ISession session,
     IContentManager contentManager,
     IMemoryCache memoryCache)
 {
     _contentManager = contentManager;
     _session = session;
     _memoryCache = memoryCache;
 }
开发者ID:MichaelPetrinolis,项目名称:Orchard2,代码行数:9,代码来源:SiteService.cs



注:本文中的IMemoryCache类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IMenu类代码示例发布时间:2022-05-24
下一篇:
C# IMemory类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap