惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Blog of Author Tim Ferriss
S
Securelist
D
Docker
The Register - Security
The Register - Security
GbyAI
GbyAI
Recorded Future
Recorded Future
Engineering at Meta
Engineering at Meta
Stack Overflow Blog
Stack Overflow Blog
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
罗磊的独立博客
博客园 - 【当耐特】
F
Full Disclosure
WordPress大学
WordPress大学
腾讯CDC
小众软件
小众软件
大猫的无限游戏
大猫的无限游戏
D
DataBreaches.Net
SecWiki News
SecWiki News
L
Lohrmann on Cybersecurity
I
InfoQ
MyScale Blog
MyScale Blog
量子位
Cyberwarzone
Cyberwarzone
博客园 - 三生石上(FineUI控件)
The Hacker News
The Hacker News
F
Fortinet All Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Jina AI
Jina AI
博客园_首页
H
Help Net Security
K
Kaspersky official blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Webroot Blog
Webroot Blog
Blog — PlanetScale
Blog — PlanetScale
V
Vulnerabilities – Threatpost
Y
Y Combinator Blog
The Cloudflare Blog
P
Proofpoint News Feed
V
Visual Studio Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tailwind CSS Blog
爱范儿
爱范儿
P
Privacy International News Feed
Security Archives - TechRepublic
Security Archives - TechRepublic
The GitHub Blog
The GitHub Blog
C
Cybersecurity and Infrastructure Security Agency CISA
B
Blog RSS Feed

memcached

理解 memcached 源码 - Slab I - V2EX memcached 确实缺少一些高级特性 - V2EX memcached 有没有什么比较好用的命令行工具? - V2EX
学习 memcached 的一些记录 - V2EX
handsomeFu · 2017-03-05 · via memcached

什么是 memcached :

  1. memcached之前是danga的一个项目,最早是为 LiveJournal 服务的,当初设计师为了加速 LiveJournal 访问速度而开发的,后来被很多大型项目采用。官网是www.danga.com或者是memcached.org
  2. Memcached是一个高性能的分布式内存对象缓存系统,全世界有不少公司采用这个缓存项目来构建大负载的网站,来分担数据库的压力。 Memcached是通过在内存里维护一个统一的巨大的 hash 表,memcached能存储各种各样的数据,包括图像、视频、文件、以及数据库检索的结果等。简单的说就是将数据调用到内存中,然后从内存中读取,从而大大提高读取速度。

特征 :

memcached 作为高速运行的分布式缓存服务器,具有以下的特点。

  • 协议简单
  • 基于 libevent 的事件处理
  • 内置内存存储方式
  • memcached 不互相通信的分布式

支持的语言:

许多语言都实现了连接memcached的客户端,其中以 Perl 、 PHP 为主。仅仅memcached网站上列出的有:

  • Perl
  • PHP
  • Python
  • Ruby
  • C#
  • C/C++
  • Lua
  • 等等

Memcached 用户:

  • LiveJournal
  • Wikipedia
  • Flickr
  • Bebo
  • Twitter
  • Typepad
  • Yellowbot
  • Youtube
  • WordPress.com
  • Craigslist
  • Mixi

安装和启动memcached

  1. windows :

    • 安装:memcached.exe -d install
    • 启动:memcached.exe -d start
  2. linux ( Ubuntu/Debian ):

    • 安装:sudo apt-get install memcached
    • 启动:sudo service memcached start
  3. linux ( Redhat/Fedora/Centos ):

    • 安装:yum install memcached
    • 启动:yum service memcached start
  4. 可能出现的问题:

    • 提示你没有权限:在打开 cmd 的时候,右键使用管理员身份运行。
    • 提示缺少pthreadGC2.dll文件:将pthreadGC2.dll文件拷贝到windows/System32.
    • 不要放在含有中文的路径下面。
  5. 启动memcached

    • -d:这个参数是让memcached在后台运行。
    • -m:指定占用多少内存。
    • -p:指定占用的端口。默认端口是11211
    • -l:哪些 ip 地址可以链接。

telnet操作memcached

  1. 添加数据:
    • set
      • 语法:

        set key flas(0) timeout value_length
        value
        
      • 示例:

        set username 0 60 7
        xiaotuo
        
    • add
      • 语法:

        add key flas(0) timeout value_length
        value
        
      • 示例:

        add username 0 60 7
        xiaotuo
        

setadd的区别:add是只负责添加数据,不会去修改数据。如果添加的数据的key已经存在了,则添加失败,如果添加的key不存在,则添加成功。而set不同,如果memcached中不存在相同的key,则进行添加,如果存在,则替换。

  1. 获取数据:

    • 语法:
      get key
      
    • 示例:
      get username
      
  2. 删除数据:

    • 语法:
      delete key
      
    • 示例:
      delete username
      
    • flush_all:删除memcached中的所有数据。
  3. 查看memcached的当前状态:

    • 语法:stats