当前位置: 首页>>代码示例>>C#>>正文


C# ICache类代码示例

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


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

示例1: PreStartInitialise

        public static void PreStartInitialise()
        {
            switch (WebConfigSettings.CacheProviderType)
            {

            #if !NET35
                case CacheTypes.AppFabricCache:

                    _cache = new AppFabricCacheAdapter();

                    break;

            #endif
                case CacheTypes.MemoryCache:
                default:
                    _cache = new MemoryCacheAdapter();

                    // http://msdn.microsoft.com/en-us/library/wcxyzt4d.aspx
                    //_cache = Activator.CreateInstance(Type.GetType(WebConfigSettings.CacheProviderType, _logger)) as ICache;

                    break;

            }

            _cacheProvider = new CacheProvider(_cache);
        }
开发者ID:saiesh86,项目名称:TravelBlog,代码行数:26,代码来源:CacheManager.cs

示例2: OpenDatabaseViewModel

        public OpenDatabaseViewModel(
            INavigationService navigationService,
            IDatabaseInfoRepository databaseInfoRepository,
            ICanSHA256Hash hasher,
            IDialogService dialogService,
            IPWDatabaseDataSource databaseSource,
            ICache cache)
        {
            _cache = cache;
            _databaseSource = databaseSource;
            _dialogService = dialogService;
            _databaseInfoRepository = databaseInfoRepository;
            _hasher = hasher;
            _navigationService = navigationService;
            var canHitOpen = this.WhenAny(
                vm => vm.Password, 
                vm => vm.KeyFileName,
                (p, k) => !string.IsNullOrEmpty(p.Value) || !string.IsNullOrEmpty(k.Value));

            OpenCommand = new ReactiveCommand(canHitOpen);
            OpenCommand.Subscribe(OpenDatabase);

            GetKeyFileCommand = new ReactiveCommand();
            GetKeyFileCommand.Subscribe(GetKeyFile); 
            
            ClearKeyFileCommand = new ReactiveCommand();
            ClearKeyFileCommand.Subscribe(ClearKeyFile);

            IObservable<string> keyFileNameChanged = this.WhenAny(vm => vm.KeyFileName, kf => kf.Value);
            keyFileNameChanged.Subscribe(v => ClearKeyFileButtonIsVisible = !string.IsNullOrWhiteSpace(v));
            keyFileNameChanged.Subscribe(v => GetKeyFileButtonIsVisible = string.IsNullOrWhiteSpace(v));
        }
开发者ID:TheAngryByrd,项目名称:MetroPass,代码行数:32,代码来源:OpenDatabaseViewModel.cs

示例3: BenchmarkRunner

 public BenchmarkRunner(ICache cache, IBenchmark benchmark)
 {
     _cache = cache;
     _benchmark = benchmark;
     _singleMeasurer = new SingleThreadedBenchmarkMeasurer(cache, benchmark);
     _multiMeasurer = new MultiThreadedBenchmarkMeasurer(cache, benchmark);
 }
开发者ID:jordansjones,项目名称:DsPerformanceTesting,代码行数:7,代码来源:BenchmarkRunner.cs

示例4: AuthorizationContextCache

 public AuthorizationContextCache(ICache cache, IControllerContextCache controllerContextCache, IControllerDescriptorCache controllerDescriptorCache, IRouteDataCache routeDataCache)
 {
     this.cache = cache;
     this.routeDataCache = routeDataCache;
     this.controllerContextCache = controllerContextCache;
     this.controllerDescriptorCache = controllerDescriptorCache;
 }
开发者ID:wanaxe,项目名称:Study,代码行数:7,代码来源:AuthorizationContextCache.cs

示例5: CobreGratisForTests

 public CobreGratisForTests(
     string clientAppIdentification, string authToken, ILogger logger, ICache cache,
     INetworkServices networkServices, IXmlSerializer xmlSerializer
     )
     : base(clientAppIdentification, authToken, logger, cache, networkServices, xmlSerializer)
 {
 }
开发者ID:FredZvt,项目名称:cobregratis-dotnet,代码行数:7,代码来源:CobreGratisTest.cs

示例6: RequestQueue

 public RequestQueue(ICache cache, INetwork network, int threadPoolSize, IResponseDelivery delivery)
 {
     this.mCache = cache;
     this.mNetwork = network;
     this.mDispatchers = new NetworkDispatcher[threadPoolSize];
     this.mDelivery = delivery;
 }
开发者ID:huguodong,项目名称:Volley-For-Xamarin-Android,代码行数:7,代码来源:RequestQueue.cs

示例7: RunCacheTests

        private static void RunCacheTests(ICache cache)
        {
            cache.Insert("ByteArray", new byte[] {0, 1, 2, 3}, CachePriority.Normal);
            cache.Insert("String", "Hello World", CachePriority.Normal);
            cache.Insert("Object", new TestObject("Test Object", 1234), CachePriority.Normal);

            var byteArray = cache.Lookup("ByteArray");
            Assert.IsNotNull(byteArray);
            Assert.AreEqual(4, byteArray.Length);
            for (int i = 0; i < 4; i++) Assert.AreEqual(i, byteArray[i]);

            var cachedString = cache.Lookup<string>("String");
            Assert.IsNotNull(cachedString);
            Assert.AreEqual("Hello World", cachedString);

            var cachedObject = cache.Lookup<TestObject>("Object");
            Assert.IsNotNull(cachedObject);
            Assert.AreEqual("Test Object", cachedObject.StringValue);
            Assert.AreEqual(1234, cachedObject.LongValue);

            cache.Remove("Object");
            Assert.IsNull(cache.Lookup("Object"));
            Assert.IsFalse(cache.ContainsKey("Object"));
            Assert.IsTrue(cache.ContainsKey("String"));
        }
开发者ID:rharrisxtheta,项目名称:BrightstarDB,代码行数:25,代码来源:CachingTests.cs

示例8: Element

        protected Element(MSpecUnitTestProvider provider,
                          IPsi psiModuleManager,
                          ICache cacheManager,
                          Element parent,
                          ProjectModelElementEnvoy projectEnvoy,
                          IClrTypeName declaringTypeName,
                          bool isIgnored)
        {
            if (declaringTypeName == null)
            {
                throw new ArgumentNullException("declaringTypeName");
            }

            if (projectEnvoy != null)
            {
                this._projectEnvoy = projectEnvoy;
            }

            this._provider = provider;
            this._declaringTypeName = declaringTypeName;
            this._psiModuleManager = psiModuleManager;
            this._cacheManager = cacheManager;

            if (isIgnored)
            {
                this.ExplicitReason = "Ignored";
            }

            this.TypeName = declaringTypeName;
            this.Parent = parent;

            this.Children = new List<IUnitTestElement>();
            this.State = UnitTestElementState.Valid;
            this._taskFactory = new UnitTestTaskFactory(this._provider.ID);
        }
开发者ID:JAllman,项目名称:machine.specifications.runner.resharper,代码行数:35,代码来源:Element.cs

示例9: SubActivityDao

 public SubActivityDao(ISession session, 
     ISettingsProvider<SubSettings> subSettings,
     ICache cache)
     : base(session, subSettings)
 {
     _cache = cache;
 }
开发者ID:skimur,项目名称:skimur,代码行数:7,代码来源:SubActivityDao.cs

示例10: SetUp

        public void SetUp()
        {
            _project = new Project(Path.GetFullPath("someProject.csproj"), new ProjectDocument(ProjectType.CSharp));
			_project.Value.SetOutputPath("");
			_project.Value.SetAssemblyName("someAssembly.dll");
            _bus = MockRepository.GenerateMock<IMessageBus>();
            _listGenerator = MockRepository.GenerateMock<IGenerateBuildList>();
            _configuration = MockRepository.GenerateMock<IConfiguration>();
            _buildRunner = MockRepository.GenerateMock<IBuildRunner>();
            _testRunner = MockRepository.GenerateMock<ITestRunner>();
			_testAssemblyValidator = MockRepository.GenerateMock<IDetermineIfAssemblyShouldBeTested>();
			_optimizer = MockRepository.GenerateMock<IOptimizeBuildConfiguration>();
            _fs = MockRepository.GenerateMock<IFileSystemService>();
            _cache = MockRepository.GenerateMock<ICache>();
            _runCache = MockRepository.GenerateMock<IRunResultCache>();
			_runInfo = new RunInfo(_project);
			_runInfo.ShouldBuild();
			_runInfo.SetAssembly(_project.Value.AssemblyName);
			_optimizer.Stub(o => o.AssembleBuildConfiguration(new string[] {})).IgnoreArguments().Return(new RunInfo[] { _runInfo });
            _preProcessor = MockRepository.GenerateMock<IPreProcessTestruns>();
            _preProcessor.Stub(x => x.PreProcess(null)).IgnoreArguments().Return(new PreProcessedTesRuns(null, new RunInfo[] { _runInfo }));
            var preProcessors = new IPreProcessTestruns[] { _preProcessor };
            var buildPreProcessor = MockRepository.GenerateMock<IPreProcessBuildruns>();
            buildPreProcessor.Stub(x => x.PreProcess(null)).IgnoreArguments().Return(new RunInfo[] { _runInfo });
            var buildPreProcessors = new IPreProcessBuildruns[] { buildPreProcessor };
            _removedTestLocator = MockRepository.GenerateMock<ILocateRemovedTests>();
            _buildSessionRunner = new BuildSessionRunner(new BuildConfiguration(null), _cache, _bus, _configuration, _buildRunner, buildPreProcessors, _fs, _runCache);
            _consumer = new ProjectChangeConsumer(_bus, _listGenerator, _configuration, _buildSessionRunner, new ITestRunner[] { _testRunner }, _testAssemblyValidator, _optimizer, preProcessors, _removedTestLocator);
        }
开发者ID:Vernathic,项目名称:ic-AutoTest.NET4CTDD,代码行数:29,代码来源:ProjectChangeConsumerTest.cs

示例11: lock

        ICache ICachingFactory.Create()
        {
            if (_caches == null)
            {
                lock (_syncObj)
                {
                    if (_caches == null)
                    {
                        var assemblyName = CachingConfig.GetCacheProvider();
                        if (String.IsNullOrWhiteSpace(assemblyName))
                        {
                            _caches = new NoCacheProvider();
                        }
                        else
                        {
                            var assemblys = assemblyName.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                            var handler = Activator.CreateInstance(assemblys[0], assemblys[1]);
                            var obj = handler.Unwrap();
                            _caches = obj as ICache;
                        }

                    }
                }
            }

            return _caches;
        }
开发者ID:ngnono,项目名称:NGnono.Framework,代码行数:27,代码来源:CachingFactory.cs

示例12: AccessToken

		async Task<IAccessToken> IAccessTokenProvider.ProvisionAccessTokenAsync(
			IEnumerable<Claim> claims,
			IEnumerable<Scope> scopes,
			ICache cache
			) {

			if( cache == null ) {
				cache = new NullCache();
			}

			claims = claims.ToList();
			scopes = scopes.ToList();

			string cacheKey = TokenCacheKeyBuilder.BuildKey( claims, scopes );

			CacheResponse cacheResponse = await cache.GetAsync( cacheKey ).SafeAsync();

			if( cacheResponse.Success ) {
				SecurityToken securityToken = m_tokenHandler.ReadToken( cacheResponse.Value );
				if( securityToken.ValidTo > DateTime.UtcNow.Add( m_tokenRefreshGracePeriod ) ) {
					return new AccessToken( cacheResponse.Value );
				}
			}

			IAccessToken token =
				await m_accessTokenProvider.ProvisionAccessTokenAsync( claims, scopes ).SafeAsync();

			DateTime validTo = m_tokenHandler.ReadToken( token.Token ).ValidTo;

			await cache.SetAsync( cacheKey, token.Token, validTo - DateTime.UtcNow ).SafeAsync();
			return token;
		}
开发者ID:mpharoah-d2l,项目名称:D2L.Security.OAuth2,代码行数:32,代码来源:CachedAccessTokenProvider.cs

示例13: SplashViewModel

 public SplashViewModel(INavigationService navigationService, ITrelloApiSettings settings, ITrello api, ICache cache)
 {
     _navigationService = navigationService;
     _settings = settings;
     _cache = cache;
     _api = api;
 }
开发者ID:Bunk,项目名称:trellow,代码行数:7,代码来源:SplashViewModel.cs

示例14: Stop

 /// <summary>
 /// Stops pruning.
 /// </summary>
 public void Stop()
 {
     _timer.Change(Timeout.Infinite, Timeout.Infinite);
     _timer.Dispose();
     _timer = null;
     Cache = null;
 }
开发者ID:shijucv,项目名称:ninject,代码行数:10,代码来源:GarbageCollectionCachePruner.cs

示例15: DataTableHandler

 public DataTableHandler(DataSet dataSet)
 {
     _cache = new SimpleCache();
     _precache = new Hashtable();
     _dset = dataSet;
     _hasRelations = false;
 }
开发者ID:Easun,项目名称:ChameleonProject,代码行数:7,代码来源:DataTableHandler.cs


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