zoukankan      html  css  js  c++  java
  • 数据库缓存

    一:缓存(自定义缓存)(掌握)
    将数据从数据库/文件取出来放在服务器的内存中,这样后面的用户来获取数据,不能查询数据库,直接从内存
    (缓存)中获取数据,提高了访问速度,节省了时间,也减轻了数据库的压力

    缓存是空间换时间的技术

    什么样的内容适合放缓存中
    经常被查询,但是不是经常改动的数据

    分布式缓存
    缓存是网址优化的第一个手段

    cache 与session的区别
    每个用户都有自己单独的session,对象
    但是cache的数据是大家共享的


    三:页面缓存 (掌握)

     1 服务器端
     2  protected void Page_Load(object sender, EventArgs e)
     3         {
     4             BLL.UserInfoService UserInfoService = new BLL.UserInfoService();
     5           UserInfo userInfo= UserInfoService.GetModel(int.Parse(Request.QueryString["Id"]));
     6           List<UserInfo> list = new List<UserInfo>();
     7           list.Add(userInfo);
     8           this.DetailsView1.DataSource = list;
     9            this.DetailsView1.DataBind();
    10         }
    11 
    12 客户端
    13 
    14 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ShowDetailCache.aspx.cs" Inherits="CZBK.TestProject.WebApp._2014_11_17.ShowDetailCache" %>
    15 
    16 <%@ OutputCache Duration="5" VaryByParam="*" %> 页面缓存 如果是none的话,则id 都是1
    17 <!DOCTYPE html>
    18 
    19 <html xmlns="http://www.w3.org/1999/xhtml">
    20 <head runat="server">
    21 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    22     <title></title>
    23 </head>
    24 <body>
    25     <form id="form1" runat="server">
    26     <div>
    27         <asp:DetailsView ID="DetailsView1" runat="server" Height="105px" Width="506px"></asp:DetailsView>
    28     </div>
    29     </form>
    30 </body>
    31 </html>

    四 数据源缓存 (了解)

    五 文件缓存依赖(了解)

      微软AJAX(了解)(ToolKit)

  • 相关阅读:
    Python_函数
    Python中元组,列表,字典的区别
    Oracle 在字符串中输入单引号或特殊字符
    Visual Studio Code管理MySQL
    Python .pyc的编译和反编译
    Django 模板变量之 forloop
    浅谈Django基础(HttpResponse、render、redirect)
    Django 使用form表单提交数据报错: Forbidden (403)
    Django出错提示TemplateDoesNotExist at /
    使用 vs code 创建 Django 项目
  • 原文地址:https://www.cnblogs.com/liuweiqiang11188/p/6686074.html
Copyright © 2011-2022 走看看