摘要: 1. 为什么在redis中,一个页面会保存两个key:cache_key以及cache_header? 2. 页面缓存是如何被唯一标识的?当请求头不同的时候(比如换了一个用户请求相同的页面)会使用同一个缓存吗? 阅读全文
posted @ 2021-03-10 15:43 luozx207 阅读(629) 评论(0) 推荐(0) 编辑
摘要: 执行顺序 按照settings.MIDDLEWARE的顺序,先由上至下执行所有的process_request,然后由上至下执行所有的process_view,最后由下至上执行所有的process_response。如: MIDDLEWARE = [ "django.middleware.secur 阅读全文
posted @ 2020-12-11 17:01 luozx207 阅读(330) 评论(0) 推荐(0) 编辑
摘要: 寻找一个数 def binarysearch(nums, target): n = len(nums) if n == 0: return -1 left = 0 right = n - 1 while left <= right: mid = (left + right) // 2 if targ 阅读全文
posted @ 2020-12-01 16:37 luozx207 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 139. 单词拆分 https://leetcode-cn.com/problems/word-break/ class Solution(object): def wordBreak(self, s, wordDict): """ :type s: str :type wordDict: List 阅读全文
posted @ 2020-11-02 15:11 luozx207 阅读(121) 评论(0) 推荐(0) 编辑
摘要: git对象 git是面向对象的,对象存储在.git/objects文件夹中。此文件夹中,一个对象就是一个文件,文件名就是对象的id 提交commit的时候,每个文件都是一个数据对象,一个树对象会用来维护一次提交的所有数据对象,如果提交的内容包含文件夹,那么这个文件夹也会是一个树对象 一次提交就是一个 阅读全文
posted @ 2020-10-29 14:53 luozx207 阅读(444) 评论(0) 推荐(0) 编辑
摘要: request.POST request实际上是django/core/handlers/wsgi.py::WSGIRequest的实例,而WSGIRequest是HttpRequest的子类 class WSGIRequest(http.HttpRequest): def _get_post(se 阅读全文
posted @ 2020-10-20 16:28 luozx207 阅读(1324) 评论(0) 推荐(1) 编辑
摘要: connections与connection db.connections是一个类似字典的对象,可以通过某个数据库连接的别名获取这个数据源的connection。比如connections['my_db_alias'] from django.db import connections for ke 阅读全文
posted @ 2020-09-08 18:37 luozx207 阅读(1533) 评论(0) 推荐(0) 编辑
摘要: https://leetcode-cn.com/problems/increasing-subsequences/ class Solution(object): def findSubsequences(self, nums): """ :type nums: List[int] :rtype: 阅读全文
posted @ 2020-08-25 17:59 luozx207 阅读(147) 评论(0) 推荐(0) 编辑
摘要: https://leetcode-cn.com/problems/palindromic-substrings/ class Solution(object): def countSubstrings(self, s): """ :type s: str :rtype: int """ # 遍历s, 阅读全文
posted @ 2020-08-19 18:14 luozx207 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 聚合的范围是search query过滤出的数据 四种聚合类型: 一、Bucketing 桶聚合,常规的分类然后计算每个分类的文档数量 二、Metric 分类并对一组文档进行sum、avg等数学运算 三、Matrix 可在多个字段上计算,生成矩阵结果 四、Pipeline 对聚合的结果再次聚合 Pi 阅读全文
posted @ 2020-08-17 15:17 luozx207 阅读(1447) 评论(0) 推荐(0) 编辑