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

C# DataCache类代码示例

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

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



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

示例1: GetCache

        public static DataCache GetCache()
        {
            if (_cache != null)
            {
                return _cache;
            }

            //Define Array for 1 Cache Host
            var servers = new List<DataCacheServerEndpoint>(1);

            //Specify Cache Host Details
            //  Parameter 1 = host name
            //  Parameter 2 = cache port number
            servers.Add(new DataCacheServerEndpoint("DevMongoDB2", 22233));

            //Create cache configuration
            var configuration = new DataCacheFactoryConfiguration
                {
                    Servers = servers,
                    LocalCacheProperties = new DataCacheLocalCacheProperties()
                };

            //Disable tracing to avoid informational/verbose messages on the web page
            DataCacheClientLogManager.ChangeLogLevel(System.Diagnostics.TraceLevel.Off);

            //Pass configuration settings to cacheFactory constructor

            //_factory = new DataCacheFactory(configuration);
            _factory = new DataCacheFactory(configuration: configuration);

            //Get reference to named cache called "default"
            _cache = _factory.GetCache("default");

            return _cache;
        }
开发者ID:jrcavallaro,项目名称:DotNet,代码行数:35,代码来源:CashUtil.cs


示例2: CreateVideoAsync

        public async Task<Video> CreateVideoAsync(string title, string description, string name, string type, Stream dataStream)
        {
            // Create an instance of the CloudMediaContext
            var mediaContext = new CloudMediaContext(
                                             CloudConfigurationManager.GetSetting("MediaServicesAccountName"),
                                             CloudConfigurationManager.GetSetting("MediaServicesAccountKey"));

            // Create the Media Services asset from the uploaded video
            var asset = mediaContext.CreateAssetFromStream(name, title, type, dataStream);

            // Get the Media Services asset URL
            var videoUrl = mediaContext.GetAssetVideoUrl(asset);

            // Launch the smooth streaming encoding job and store its ID
            var jobId = mediaContext.ConvertAssetToSmoothStreaming(asset, true);

            var video = new Video
                {
                    Title = title,
                    Description = description,
                    SourceVideoUrl = videoUrl,
                    JobId = jobId
                };

            this.context.Videos.Add(video);
            await this.context.SaveChangesAsync();

            var cache = new DataCache();
            cache.Remove("videoList");

            return video;
        }
开发者ID:kirpasingh,项目名称:MicrosoftAzureTrainingKit,代码行数:32,代码来源:VideoService.cs


示例3: UseAppFabric

        public static IDependencyResolver UseAppFabric(this IDependencyResolver resolver, String eventKey, TimeSpan cacheRecycle, DataCache dc)
        {
            var bus = new Lazy<AppFabricMessageBus>(() => new AppFabricMessageBus(resolver, eventKey, cacheRecycle, dc));
            resolver.Register(typeof(IMessageBus), () => bus.Value);

            return resolver;
        }
开发者ID:LloydPickering,项目名称:SignalR.AppFabric,代码行数:7,代码来源:DependencyResolverExtensions.cs


示例4: GetCache

        public static DataCache GetCache()
        {
            if (_cache != null)
                return _cache;

            //Define Array for 1 Cache Host
            List<DataCacheServerEndpoint> servers = new List<DataCacheServerEndpoint>(1);

            //Specify Cache Host Details
            //  Parameter 1 = host name
            //  Parameter 2 = cache port number
            servers.Add(new DataCacheServerEndpoint("192.168.1.31", 22233));

            //Create cache configuration
            DataCacheFactoryConfiguration configuration = new DataCacheFactoryConfiguration();

            //Set the cache host(s)
            configuration.Servers = servers;

            //Set default properties for local cache (local cache disabled)
            configuration.LocalCacheProperties = new DataCacheLocalCacheProperties();

            //Disable tracing to avoid informational/verbose messages on the web page
            DataCacheClientLogManager.ChangeLogLevel(System.Diagnostics.TraceLevel.Off);

            //Pass configuration settings to cacheFactory constructor
            _factory = new DataCacheFactory(configuration);

            //Get reference to named cache called "default"
            _cache = _factory.GetCache("default");

            return _cache;
        }
开发者ID:CuneytKukrer,项目名称:TestProject,代码行数:33,代码来源:Program.cs


示例5: FillAppFabricCache

 //static FillAppFabricCache()
 //{
 //    DataCacheFactory factory = new DataCacheFactory();
 //    _cache = factory.GetCache("default");
 //    //Debug.Assert(_cache == null);
 //}
 public FillAppFabricCache(CancellationToken ct, DataCache cache, byte[] probeTemplate, ArrayList fingerList)
 {
     _ct = ct;
     _cache = cache;
     _probeTemplate = probeTemplate;
     _fingerList = fingerList;
 }
开发者ID:rid50,项目名称:PSCBioOffice,代码行数:13,代码来源:FillAppFabricCache.cs


示例6: AzureOutputCacheStorageProvider

        public AzureOutputCacheStorageProvider(ShellSettings shellSettings, IAzureOutputCacheHolder cacheHolder) {

            var region = shellSettings.Name;

            // Azure Cache supports only alphanumeric strings for regions, but Orchard supports some
            // non-alphanumeric characters in tenant names. Remove all non-alphanumering characters
            // from the region, and append the hash code of the original string to mitigate the risk
            // of two distinct original region strings yielding the same transformed region string.
            _regionAlphaNumeric = new String(Array.FindAll(region.ToCharArray(), Char.IsLetterOrDigit)) + region.GetHashCode().ToString(CultureInfo.InvariantCulture);


            _cache = cacheHolder.TryGetDataCache(() => {
                CacheClientConfiguration cacheConfig;

                try {
                    cacheConfig = CacheClientConfiguration.FromPlatformConfiguration(shellSettings.Name, Constants.OutputCacheSettingNamePrefix);
                    cacheConfig.Validate();
                }
                catch (Exception ex) {
                    throw new Exception(String.Format("The {0} configuration settings are missing or invalid.", Constants.OutputCacheFeatureName), ex);
                }

                var cache = cacheConfig.CreateCache();
                cache.CreateRegion(_regionAlphaNumeric);

                return cache;
            });
        }
开发者ID:kanujhun,项目名称:orchard,代码行数:28,代码来源:AzureOutputCacheStorageProvider.cs


示例7: Run

        public override void Run()
        {
            DataCache dataCache = null;
            var roleInstanceId = RoleEnvironment.CurrentRoleInstance.Id;

            while (true)
            {
                if (dataCache == null)
                {
                    try
                    {
                        dataCache = new DataCache("default");
                    }
                    catch (DataCacheException)
                    {
                        Thread.Sleep(1000);
                        continue;
                    }
                }

                var value = dataCache.Get("Tim");
                if (value != null)
                {
                    EventLog.WriteEntry(
                        string.Concat("AzureCache ", roleInstanceId),
                        string.Concat("Tim = ", (string)value));

                    // Uncomment for Azure testing.
                    // dataCache.Put("Tim", string.Concat((string)value, RoleEnvironment.CurrentRoleInstance.Id));
                }

                Thread.Sleep(2000);
            }
        }
开发者ID:BernieCook,项目名称:AzureCache,代码行数:34,代码来源:WorkerRole.cs


示例8: Main

 internal static void Main(string[] args)
 {
     DataCache svr = new DataCache();
     svr.Init(args);
     svr.Loop();
     svr.Release();
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:7,代码来源:DataCache.cs


示例9: Application_Start

        protected void Application_Start(object sender, EventArgs e)
        {
            String l_strDataSource = OAConfig.GetConfig("数据库", "DataSource");
            String l_strDatabase = OAConfig.GetConfig("数据库", "DataBase");
            String l_strUserId = OAConfig.GetConfig("数据库", "uid");
            String l_strPassword = OAConfig.GetConfig("数据库", "pwd");

            //初始化数据库连接
            if (!Entity.InitDB(ConstString.Miscellaneous.DATA_BASE_TYPE, l_strDataSource, l_strDatabase, l_strUserId, l_strPassword, 30))
            {
                throw new Exception("数据库连接错误");
            }

            SQLHelper.InitDB1(OAConfig.GetConfig("数据库", "ADIMSqlServer"));
            SQLHelper.InitDB2(OAConfig.GetConfig("数据库", "AgilePointSqlServer"));

            //自动阅知
            AutoRead.Instance.TimerStart();
            //自动迁移旧数据
            AutoBackup.Instance.TimerStart();

            //把XML文件加载到缓存中
            string strPath = AppDomain.CurrentDomain.BaseDirectory + @"Config\SelectGroup.xml";
            if (!string.IsNullOrEmpty(strPath))
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(strPath);
                DataCache cache = new DataCache();
                cache.ExpireTime = 1440;
                cache.CacheName = "SelectGroup";
                cache.CacheItemName = "SelectGroupItem";
                cache.SetCache(doc);
            }
        }
开发者ID:BGCX261,项目名称:zhoulijinrong-svn-to-git,代码行数:34,代码来源:Global.asax.cs


示例10: LookUp

 public LookUp(ArrayList fingerList, int gender, byte[] probeTemplate, DataCache cache, CancellationToken ct)
 {
     _fingerList     = fingerList;
     _gender         = gender;
     _probeTemplate  = probeTemplate;
     _cache          = cache;
     _ct             = ct;
 }
开发者ID:rid50,项目名称:PSCBioOfficeWeb,代码行数:8,代码来源:LookUp.cs


示例11: TestGetInvalid

 public void TestGetInvalid ()
 {
     RunAsync (async delegate {
         var cache = new DataCache ();
         var data = await cache.GetAsync<WorkspaceData> (Guid.NewGuid ());
         Assert.IsNull (data);
     });
 }
开发者ID:VDBBjorn,项目名称:toggl_mobile,代码行数:8,代码来源:DataCacheTest.cs


示例12: TestTryGetInvalid

 public void TestTryGetInvalid ()
 {
     var cache = new DataCache ();
     WorkspaceData data;
     var success = cache.TryGetCached (Guid.NewGuid (), out data);
     Assert.IsFalse (success);
     Assert.IsNull (data);
 }
开发者ID:VDBBjorn,项目名称:toggl_mobile,代码行数:8,代码来源:DataCacheTest.cs


示例13: DistributeCache

		internal DistributeCache(DataCache dataCache, string cacheName, string regionName)
		{
			this.dataCache = dataCache;
			this.cacheName = cacheName;
			this.regionName = regionName;

			this.asyncUpdateInterval = CacheSettings.Instance.GetAsyncUpdateInterval(cacheName, regionName);
		}
开发者ID:Kjubo,项目名称:xms.core,代码行数:8,代码来源:DistributeCache.cs


示例14: AzureCacheStore

	    public AzureCacheStore(DataCache cache, string cacheRegion)
        {
            _cacheRegion = cacheRegion;
	        _cache = cache;

            if (!string.IsNullOrEmpty(_cacheRegion))
                _cache.CreateRegion(_cacheRegion);
        }
开发者ID:yyf919,项目名称:CacheCow,代码行数:8,代码来源:AzureCacheStore.cs


示例15: ShouldReturnNotNullInstances

            public void ShouldReturnNotNullInstances()
            {
                var cache = new DataCache();

                Assert.NotNull(cache.Empty);
                Assert.NotNull(cache.MonitorConfigs);
                Assert.NotNull(cache.MonitorInfo);
            }
开发者ID:Zocdoc,项目名称:ZocMon,代码行数:8,代码来源:TestForDataCache.cs


示例16: RealTest

 public RealTest(string title, List<string> headers, UserCache userCache)
 {
     this.title = title;
     this.headers = headers;
     UserCache = userCache;
     DataCache = new DataCache();
     testResults = new List<RowResult>();
     ChildInstructions = new List<IInstruction>();
 }
开发者ID:manderdev,项目名称:monkeypants,代码行数:9,代码来源:RealTest.cs


示例17: TryGetDataCache

        public DataCache TryGetDataCache(Func<DataCache> builder) {
            lock (_synLock) {
                if (_dataCache != null) {
                    return _dataCache;
                }

                return _dataCache = builder();
            }
        }
开发者ID:jdages,项目名称:AndrewsHouse,代码行数:9,代码来源:IAzureOutputCacheHolder.cs


示例18: FillAppFabricCache

 public FillAppFabricCache(BlockingCollection<int> bc, SendOrPostCallback callback, ArrayList fingerList, int maxPoolSize, CancellationToken ct, DataCache cache)
 {
     _bc         = bc;
     _callback   = callback;
     _fingerList = fingerList;
     _maxPoolSize = maxPoolSize;
     _ct         = ct;
     _cache      = cache;
     //_context = context;
 }
开发者ID:rid50,项目名称:PSCBioOfficeWeb,代码行数:10,代码来源:FillAppFabricCache.cs


示例19: GetCache

        private static DataCache GetCache()
        {
            if (_cache != null) return _cache;

            var configuration = new DataCacheFactoryConfiguration();
            _factory = new DataCacheFactory(configuration);
            _cache = _factory.GetCache("default");

            return _cache;
        }
开发者ID:gitter-badger,项目名称:vc-community-1.x,代码行数:10,代码来源:AppFabricCacheRepository.cs


示例20: AzureDataCacheIndexInput

        public AzureDataCacheIndexInput(string name, string cacheRegion, DataCache persistantCache)
        {
            _persistantCache = persistantCache;
            _name = name;
            _cacheRegion = cacheRegion;

            var data = _persistantCache.Get(name, _cacheRegion);
            byte[] streamData = data == null ? new byte[] { } : (byte[])data;
            _stream = new MemoryStream(streamData, false);
        }
开发者ID:ajorkowski,项目名称:AzureDataCacheDirectory,代码行数:10,代码来源:AzureDataCacheIndexInput.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# DataClass类代码示例发布时间:2022-05-24
下一篇:
C# DataBox类代码示例发布时间: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