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


C# DataCache.Put方法代码示例

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


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

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

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

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

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

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

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

示例7: SetToken

		public void SetToken(Guid token)
		{
			var mycache = new DataCache();
			mycache.Put(CacheKey, token);
		}
开发者ID:uWebshop,项目名称:-INACTIVE-uWebshop-Core,代码行数:5,代码来源:AzureAppCacheTokenService.cs

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

示例9: PutInfo

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

示例10: Catalog

            public Catalog(DataCache cache)
            {
                _cache = cache;
                var entries = _cache.Get(CacheProvider.CacheEntriesKey);
                if (entries == null)
                {
                    entries = new Dictionary<string, DateTime>();
                    _cache.Put(CacheProvider.CacheEntriesKey, entries);
                }

                _entries = (Dictionary<string, DateTime>)_cache.GetAndLock(CacheProvider.CacheEntriesKey, new TimeSpan(0, 0, 60), out _lockHandle);
            }
开发者ID:transformersprimeabcxyz,项目名称:cslacontrib-MarimerLLC,代码行数:12,代码来源:CacheProvider.cs

示例11: GetUserByEntidade

        public IQueryable<UserProfile> GetUserByEntidade(int entidadeId)
        {
            m_cache = CacheUtil.GetCache();
            DataCacheItemVersion version = null;
            IQueryable<UserProfile> result = (IQueryable<UserProfile>)m_cache.Get("UserProfileGetUserByEntidade" + entidadeId, out version);
            if (result == null)
            {
                result = context.UserProfiles.Where(u => u.entidadeId == entidadeId);
                m_cache.Put("UserProfileGetUserByEntidade_" + entidadeId, result);
            }

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

示例12: CacheDemo

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


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