Is there any difference between session and memcahed or redis? If it is,and what is that? - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
shanechiu
V2EX    Python

Is there any difference between session and memcahed or redis? If it is,and what is that?

  •  
  •   shanechiu
    shanezhiu 2017-12-11 15:08:45 +08:00 3454 次点击
    这是一个创建于 2873 天前的主题,其中的信息可能已经有所发展或是发生改变。

    I am confused about session,memcached/redis.

    I often store the login infor into a memcached server or a redis, and then could we call that is a session?

    if not,what does a session point and what's the

    difference between memcached/redis and session? I have looked up into google,but I can not understand it still.

    So,could you do me a favor? Thanks in advance!

    Append:

    I am a new fish on HTTP, and if this question makes you unhappy, you'd better to forget it. LOL...

    第 1 条附言    2017-12-11 17:08:08 +08:00
    Firstly, I would not like to make an argument with anybody.


    Somebody said you went against public order and good morals in this community.

    I am not clear about that, and then I searched on Wikipedia and Baike. Share with you.

    1. 公序良俗 https://baike.baidu.com/item/%E5%85%AC%E5%BA%8F%E8%89%AF%E4%BF%97#2
    2. 公序良俗 https://ja.wikipedia.org/wiki/%E5%85%AC%E5%BA%8F%E8%89%AF%E4%BF%97

    I went through it, and as a result, it seems like I did nothing against public order and good morals.

    Ok, if there is any on v2ex, you can show me.

    Somebody said, why don't you go to **reddit** or **stack Overflow** to get an answer or improve you English?

    Well, I will do that next time.

    But I wonder know whether there is any post rule about language limit(you shouldn't use English, you can only use Chinese on this site?) on V2EX or it is just a morally hijacked.

    This is a question for learning, and it is not for arguments or catfights. Please take care of your words.

    The END.
    第 2 条附言    2017-12-11 19:29:25 +08:00
    谢谢所有的善意的指导,我会去 Stack Overflow 或者 Reddit 的.
    对于某些人说我态度不好,我不知道我那句话用得不好。

    我的初衷不是为了装逼,只要不嘲笑这一点,其他我都无所谓。
    35 条回复    2018-01-09 23:25:51 +08:00
    flyingghost
        1
    flyingghost  
       2017-12-11 15:22:39 +08:00   10
    session 是一种意图,一种妄图在无状态的 HTTP 里标记每个 client 状态的意图。
    这个意图的实现需要 6 个组成步骤:
    1,server 生成标明 client 的标记。(用什么方式标明?例:session 对象及其 sessionID )
    2,把这个标记存储在 server 端。(存在哪里?例:磁盘文件)
    3,把这个标记发往 client。(通过什么方式发送?例:Set-Cookie 头)
    4,client 存储这份标记。(如何存储?例:Cookie 存储)
    5,client 下次请求的时候,携带这份标记。(如何确保自动携带?通过什么东西承载?例:Cookie 头)
    6,server 端根据标记去 2 里面找到对应的 client。

    session 是一种机制。
    而 redis/memcache 只是用来存储标记的位置而已,他们只负责第 2 点部分。
    shanechiu
        2
    shanechiu  
    OP
       2017-12-11 15:30:53 +08:00
    @flyingghost Well, I agree with you on session is an intention and it is also a mechanism. But, I wonder know who carries out the first step. A web server,like Nginx, Apache HTTP or others?
    dcll222
        3
    dcll222  
       2017-12-11 15:38:01 +08:00
    session 是数据, redis/memcached 是存储数据的手段
    leetom
        4
    leetom  
       2017-12-11 15:39:48 +08:00   1
    @shanechiu Web 服务器不负责生成,是你的应用生成的。没有 Session, 所有的 HTTP 功能都能正常工作,只是服务器不知道对方是谁了。甚至你可以自己通过 token 来模拟 session 的所有功能。

    另外,英语不好为啥不用中文呢 orz
    flyingghost
        5
    flyingghost  
       2017-12-11 15:40:07 +08:00
    @shanechiu 一般是应用服务器。例如:PHP、Tomcat 等。nginx 一般不管这事。
    Cooky
        6
    Cooky  
       2017-12-11 15:40:38 +08:00 via Android
    装老外 666
    shanechiu
        7
    shanechiu  
    OP
       2017-12-11 15:44:44 +08:00
    @leetom Well,I also know my English poor, and I am doing my best to improve it. Applying is a basic way to perfect my English, isn't it? But,thank you all the same.
    oott123
        8
    oott123  
       2017-12-11 15:49:28 +08:00   3
    如果楼主是想练习英文,可以考虑去 reddit 之类的英文社区逛逛。请你在达成“练习自己的英文水平”目的的同时,也考虑下这个社区其它人的感受,毕竟这是一个中文社区。更何况你在期望其他人给你回答,更应该站在别人的角度多多考虑一下。

    至于楼主的问题 1L 已经解释得十分清楚了。
    shanechiu
        9
    shanechiu  
    OP
       2017-12-11 15:51:28 +08:00
    @oott123 if you do not like it, just ignore it. Thanks all the same.
    oott123
        10
    oott123  
       2017-12-11 15:53:37 +08:00   2
    @shanechiu #9 并不是「我」不喜欢。
    事实上我对你或者这个帖子本身并没有什么特别的看法,只是在提醒你这样的行为在一个公共社区并不合适,以免你遗漏这一点。这是个公序良俗的问题。
    当然你听不听也随意,如果你不喜欢这种意见一样可以忽略我。
    shanechiu
        11
    shanechiu  
    OP
       2017-12-11 15:55:33 +08:00
    @oott123 That's fine.
    520671
        12
    520671  
       2017-12-11 16:03:24 +08:00
    Alternatively, we could also remind you to stop being an ignorant idiot.

    Thanks all the same.
    shanechiu
        13
    shanechiu  
    OP
       2017-12-11 16:05:58 +08:00
    @520671 Well,I wouldn't like to make a argument.
    520671
        14
    520671  
       2017-12-11 16:09:09 +08:00
    > Well,I wouldn't like to make a argument.
    ^[0]
    Oh sure you did. If you want to take a stance and ask others to be quiet for disagreeing with you, surely your actions speak louder than your words.

    [0] https://www.englishpage.com/articles/a-vs-an.htm
    shanechiu
        15
    shanechiu  
    OP
       2017-12-11 16:13:02 +08:00
    @520671 That does not make sense for me. The end. LOL
    orzfly
        16
    orzfly  
       2017-12-11 16:13:15 +08:00   3


    source: https://xkcd.com/1357/
    假如看不懂的话: http://xkcd.tw/1357
    shanechiu
        17
    shanechiu  
    OP
       2017-12-11 16:17:18 +08:00
    @orzfly got it.
    wxsm
        18
    wxsm  
       2017-12-11 16:25:23 +08:00   1
    小建议:如果你想更好地学习英文,请直接去英文社区,提问上 StackOverflow 嘛。不比在这里发个英文帖然后底下一堆中文回复的好吗?
    fml87
        19
    fml87  
       2017-12-11 16:34:15 +08:00   1
    英文标点后面要加空格
    kkzxak47
        20
    kkzxak47  
       2017-12-11 17:02:21 +08:00 via Android   1
    遇到 2 楼是你的福气,好好感谢他
    kkzxak47
        21
    kkzxak47  
       2017-12-11 17:05:16 +08:00 via Android
    也有客户端存储的 session,比如存在 cookie 里。
    session 实现机制五花八门,重要的是理解 session 的本质: 在一个没有上下文的境里试图恢复上下文
    shanechiu
        22
    shanechiu  
    OP
       2017-12-11 18:43:39 +08:00 via Android
    @kkzxak47 yep,flyinghost is nice and patient.
    beastk
        23
    beastk  
       2017-12-11 18:49:46 +08:00 via iPhone
    楼主你要是中国人,那么请用中文,如果你是老外,我们一点意见都没有,还会夸赞你好学。谢谢。
    bxb100
        24
    bxb100  
       2017-12-11 19:09:53 +08:00 via Android
    你是询问别人,那么尊重被询问人的建议也是应该的,键盘侠路过
    shanechiu
        25
    shanechiu  
    OP
       2017-12-11 19:12:56 +08:00 via Android
    @bxb100 I agree with you.
    iVeego
        26
    iVeego  
       2017-12-11 19:13:50 +08:00
    @orzfly #16 网站很有趣,收藏了。感谢。
    Livid
        27
    Livid  
    MOD
    PRO
       2017-12-11 19:21:04 +08:00   1
    @oott123 这种 Chinglish 看着太辣眼睛了。已经降权这个账号 -8。
    iVeego
        28
    iVeego  
       2017-12-11 19:24:42 +08:00
    @Livid #27 哈哈哈,我还想回复楼主几个语法错误呢,不过看他回复 @520671 的态度,我觉得又没有必要了。
    flyico
        29
    flyico  
       2017-12-11 19:25:46 +08:00 via iPhone   1
    想练英文应该去 SO 或者 Reddit 在中文网站上用英文纯属装 B 而且只会越来越 Chinglish
    huangsw
        30
    huangsw  
       2017-12-11 19:29:03 +08:00   1
    心疼楼主 1s. The end. LOL
    shanechiu
        31
    shanechiu  
    OP
       2017-12-11 19:42:19 +08:00 via Android
    @Livid 所以,能请教一下吗?我该怎么转变我这种中式英语或者说中式思维了,因为确实学英语没多久,大概两个月吧?刚看了一些语法书,然后尝试着去造了句子.我也知道自己输入的不够,但是我的确想掌握英语,毕竟刚学的东西容易忘,如果要掌握的法就是用。我目前确实没有太多机会去给人写 email 或者直接沟通?我目前还没有找到比较好的方法,我能做的是造句。你如果你有比较好的方法,那么可以推荐给我吗?
    shanechiu
        32
    shanechiu  
    OP
       2017-12-11 19:43:44 +08:00 via Android
    @iVeego 我很好奇在你眼里我是什么态度。我的确不想争论跟他争论。
    shanechiu
        33
    shanechiu  
    OP
       2017-12-11 19:45:06 +08:00 via Android
    @flyico 你是对的,但是 stack overflow 的问题门槛很高。你知道的。
    Livid
        34
    Livid  
    MOD
    PRO
       2017-12-11 20:53:12 +08:00
    @shanechiu 去一个周围大部分人都只讲英语的环境。比如美国。
    mingyun
        35
    mingyun  
       2018-01-09 23:25:51 +08:00
    1 楼正解
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     1085 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 25ms UTC 17:56 PVG 01:56 LAX 10:56 JFK 13:56
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86