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


C# DataCache.Get方法代码示例

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


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

示例1: 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

示例2: getTweets

 Tweets getTweets(string name)
 {
     DataCache cache = new DataCache();
     Tweets entries = cache.Get(name) as Tweets;
     if (entries == null)
     {
         entries = TwitterFeed.GetTweets(name);
         cache.Add(name, entries);
     }
     return entries;
 }
开发者ID:Microsoft-Web,项目名称:DEMO-UsingCloudApplicationServices,代码行数:11,代码来源:TwitterFeedController.cs

示例3: GetUserByIDIncludeEntidade

        public UserProfile GetUserByIDIncludeEntidade(int id)
        {
            m_cache = CacheUtil.GetCache();
            DataCacheItemVersion version = null;
            UserProfile result = (UserProfile)m_cache.Get("UserProfileGetUserByIDIncludeEntidade_" + id, out version);
            if (result == null)
            {
                result = context.UserProfiles.Include("entidade").Single(u => u.UserId == id);
                m_cache.Put("UserProfileGetUserByIDIncludeEntidade_" + id, result);
            }

            return result;
        }
开发者ID:jpedromo,项目名称:ISP---Gestao-de-Matriculas,代码行数:13,代码来源:UserProfileRepository.cs

示例4: FindByUsername

        public UserProfile FindByUsername(string username)
        {
            m_cache = CacheUtil.GetCache();
            DataCacheItemVersion version = null;
            UserProfile result = (UserProfile)m_cache.Get("UserProfileFindByUsername_" + username, out version);
            if (result == null)
            {
                result = context.UserProfiles.Single(u => u.UserName == username);

                m_cache.Put("UserProfileFindByUsername_" + username, result);
            }

            return result;
        }
开发者ID:jpedromo,项目名称:ISP---Gestao-de-Matriculas,代码行数:14,代码来源:UserProfileRepository.cs

示例5: getTweets

        Tweets getTweets(string name)
        {
            DataCache cache = new DataCache();

            Tweets entries = Tweets.FromObject(cache.Get(name));

            if (entries == null)
            {
                entries = TwitterFeed.GetTweets(name);
                cache.Add(name, entries.GetBytes());
            }

            return entries;
        }
开发者ID:kirpasingh,项目名称:MicrosoftAzureTrainingKit,代码行数:14,代码来源:TwitterFeedController.cs

示例6: GetPorTipologia

        public List<ValorSistema> GetPorTipologia(string tipologia)
        {

            m_cache = CacheUtil.GetCache();
            DataCacheItemVersion version = null;

            List<ValorSistema> result = (List<ValorSistema>)m_cache.Get("ValoresSistema_" + tipologia, out version);
            if (result == null)
            {
                result = context.ValoresSistema.Where(v => v.tipologia == tipologia).ToList();

                m_cache.Put("ValoresSistema_" + tipologia, result);
            }
            return result;
        }
开发者ID:jpedromo,项目名称:ISP---Gestao-de-Matriculas,代码行数:15,代码来源:ValorSistemaRepository.cs

示例7: GetToken

		public Guid GetToken()
		{
			var mycache = new DataCache();

			var cacheObject = mycache.Get(CacheKey);

			if (cacheObject == null || string.IsNullOrEmpty(cacheObject.ToString())) return Guid.Empty;
			if (cacheObject is Guid) return (Guid) cacheObject;

			Guid result;
			if (Guid.TryParse(cacheObject.ToString(), out result))
				return result;

			return Guid.Empty;
		}
开发者ID:uWebshop,项目名称:-INACTIVE-uWebshop-Core,代码行数:15,代码来源:AzureAppCacheTokenService.cs

示例8: GetAll

        public IQueryable<Video> GetAll()
        {
            var dataCache = new DataCache();
            var videos = dataCache.Get("videoList") as IEnumerable<Video>;

            if (videos == null)
            {
                videos = this.context.Videos.OrderByDescending(v => v.Id);

                dataCache.Put("videoList", videos.ToList());

                Thread.Sleep(500);
            }

            return videos.AsQueryable();
        }
开发者ID:kirpasingh,项目名称:MicrosoftAzureTrainingKit,代码行数:16,代码来源:VideoService.cs

示例9: FindCache

        public Apolice FindCache(int id)
        {
            m_cache = CacheUtil.GetCache();
            DataCacheItemVersion version = null;
            Apolice apo = (Apolice) m_cache.Get("Apolice_" + id.ToString(), out version);
            if (apo == null)
            {
                apo = context.Apolices.Include("tomador").Include("veiculo").Include("veiculo.categoria").Include("concelho").
                    Include("avisosApolice").Include("eventoHistorico").Single(a => a.apoliceId == id);

                m_cache.Put("Apolice_" + id.ToString(), apo);
            }

            return apo;
            //return context.Apolices.Find(id);
        }
开发者ID:jpedromo,项目名称:ISP---Gestao-de-Matriculas,代码行数:16,代码来源:ApoliceRepository.cs

示例10: Index

        public ActionResult Index(string name)
        {
            Stopwatch timer = new Stopwatch();
            timer.Start();

            DataCache cache = new DataCache();
            Tweets entries = cache.Get(name) as Tweets;
            if (entries == null)
            {
                entries = TwitterFeed.GetTweets(name);
                cache.Add(name, entries);
                mClient.Send(new BrokeredMessage(name));
            }

            timer.Stop();
            ViewBag.LoadTime = timer.Elapsed.TotalMilliseconds;

            return View(entries);
        }
开发者ID:Microsoft-Web,项目名称:DEMO-UsingCloudApplicationServices,代码行数:19,代码来源:TwitterFeedController.cs

示例11: Index

        public ActionResult Index(
            IndexModel indexModel,
            string button)
        {
            var dataCache = new DataCache("default");

            if (button.Equals("set"))
            {
                dataCache.Put(indexModel.Name, indexModel.Value);
            }
            else
            {
                var value = dataCache.Get(indexModel.Name);
                if (value != null)
                {
                    ModelState.Remove("Value");
                    indexModel.Value = (string)value;
                }
            }

            return View(indexModel);
        }
开发者ID:BernieCook,项目名称:AzureCache,代码行数:22,代码来源:HomeController.cs

示例12: updateHotTopics

        void updateHotTopics(string name)
        {
            DataCache cache = new DataCache();
            var tweets = cache.Get(name) as Tweets;

            if (tweets != null)
            {
                string pattern = "(#|@)[a-zA-Z0-9_]{1,15}";
                Regex regx = new Regex(pattern);

                CloudTable table = getCloudTable();
                foreach (var tweet in tweets.Items)
                {
                    string date = DateTime.Now.ToString("yyyy-MM-dd");
                    foreach (var match in regx.Matches(tweet.text))
                    {
                        string matchString = match.ToString().Substring(1);
                        TableOperation retrieveOperation = TableOperation.Retrieve<TopicEntity>
                                        (date, matchString);
                        TableResult retrievedResult = table.Execute(retrieveOperation);
                        TopicEntity updateEntity = (TopicEntity)retrievedResult.Result;
                        if (updateEntity != null)
                        {
                            updateEntity.Mentions += 1;
                            TableOperation updateOperation = TableOperation.Replace(updateEntity);
                            table.Execute(updateOperation);
                        }
                        else
                        {
                            TopicEntity entity = new TopicEntity(date, matchString);
                            TableOperation insertOperation = TableOperation.Insert(entity);
                            table.Execute(insertOperation);
                        }
                    }
                }
            }
        }
开发者ID:Microsoft-Web,项目名称:DEMO-UsingCloudApplicationServices,代码行数:37,代码来源:WorkerRole.cs

示例13: ActivateOptions

        public override void ActivateOptions()
        {
            base.ActivateOptions();

            try
            {
                DataCacheFactory factory;
                if (this.Hosts.Count != 0)
                {
                    LogLog.Debug(declaringType, "Activating host options");
                    DataCacheFactoryConfiguration config = new DataCacheFactoryConfiguration();
                    List<DataCacheServerEndpoint> servers = new List<DataCacheServerEndpoint>();
                    for (int i = 0; i < this.Hosts.Count; i++)
                    {
                        servers.Add(new DataCacheServerEndpoint(this.Hosts[i].Host, this.Hosts[i].Port));
                    }
                    config.Servers = servers;
                    factory = new DataCacheFactory(config);
                }
                else
                {
                    LogLog.Debug(declaringType, "No host options detected, using default cache factory");
                    factory = new DataCacheFactory();
                }
                _Cache = factory.GetCache(this.CacheName);

                //config region exists before we attempt to write to it.
                _Cache.CreateRegion(this.RegionName);

                var obj = _Cache.Get(Shared.LAST_PUSHED_KEY_KEY, this.RegionName);
                if (obj == null)
                {
                    _Cache.Put(Shared.LAST_PUSHED_KEY_KEY, "0", this.RegionName);
                }
            }
            catch (Exception ex)
            {
                this.ErrorHandler.Error("Could not create connection to App Fabric", ex);
                this._Cache = null;
            }
        }
开发者ID:edwinf,项目名称:AppFabricAppender,代码行数:41,代码来源:BufferedAppFabricAppender.cs

示例14: GetInfo

 public object GetInfo(DataCache _cache, string key)
 {
     return _cache.Get(key);
 }
开发者ID:lhlima,项目名称:CollaborationProjects,代码行数:4,代码来源:Program.cs

示例15: CacheDemo

 public ActionResult CacheDemo()
 {
     var cache = new DataCache();
     ViewBag.CacheValue = cache.Get("key");
     return View();
 }
开发者ID:kbaley,项目名称:AzureCodeCamp,代码行数:6,代码来源:HomeController.cs


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