search
HomeBackend DevelopmentPHP TutorialA brief analysis of memcache startup and detailed explanation of telnet commands_PHP tutorial
A brief analysis of memcache startup and detailed explanation of telnet commands_PHP tutorialJul 21, 2016 pm 03:02 PM
memcachetelnetcodeparameterstart upOrdercopyCommonly usedDetailed explanation

1、启动Memcache 常用参数

复制代码 代码如下:

-p 监听的TCP端口(默认: 11211)
-U UDP监听端口 (默认: 11211, 0 时关闭)
-d 以守护进程方式运行
-u 运行运行 Memcached的账户 非root用户
-m 最大的内存使用单位是MB 默认是64MB
-c 软连接数量默认是1024
-v 输出警告和错误信息
-vv 打印客户端的请求和返回信息
-h 打印帮助信息
-i 打印memcached和libevent的版权信息
-l 绑定地址 (默认:所有都允许,无论内外网或者本机更换IP,有安全隐患,若设置为127.0.0.1就只能本机访问)
-P 将PID写入文件,这样可以使得后边进行快速进程终止, 需要与 -d 一起使用

2、Memcache telnet 常用命令
COMMAND DESCRIPTION EXAMPLE
get Reads a value get mykey
set Set a key unconditionally set mykey 0 60 5
add Add a new key add newkey 0 60 5
replace Overwrite existing key replace key 0 60 5
append Append data to existing key append key 0 60 15
prepend Prepend data to existing key prepend key 0 60 15
incr Increments numerical key value by given number incr mykey 2
decr Decrements numerical key value by given number decr mykey 5
delete Deletes an existing key delete mykey
flush_all Invalidate specific items immediately flush_all
Invalidate all items in n seconds flush_all 900
stats Prints general statistics stats
Prints memory statistics stats slabs
Prints memory statistics stats malloc
Print higher level allocation statistics stats items
  stats detail
  stats sizes
Resets statistics stats reset
version Prints server version. version
verbosity Increases log level verbosity
quit Terminate telnet session quit

3、stats命令详解
pid memcache服务器的进程ID
uptime 服务器已经运行的秒数
time 服务器当前的unix时间戳
version memcache版本
pointer_size 当前操作系统的指针大小(32位系统一般是32bit)
rusage_user 进程的累计用户时间
rusage_system 进程的累计系统时间
curr_items 服务器当前存储的items数量
total_items 从服务器启动以后存储的items总数量
bytes 当前服务器存储items占用的字节数
curr_connections 当前打开着的连接数
total_connections 从服务器启动以后曾经打开过的连接数
connection_structures 服务器分配的连接构造数
cmd_get get命令(获取)总请求次数
cmd_set set命令(保存)总请求次数
get_hits 总命中次数
get_misses 总未命中次数
evictions 为获取空闲内存而删除的items数(分配给memcache的空间用满后需要删除旧的items来得到空间分配给新的items)
bytes_read 总读取字节数(请求字节数)
bytes_written 总发送字节数(结果字节数)
limit_maxbytes 分配给memcache的内存大小(字节)
threads 当前线程数

4. Memcache startup tips
a: Monitor the intranet address
b: Modify the default port number
c: Set the maximum number of connections and maximum memory usage

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327938.htmlTechArticle1. Start Memcache. Common parameters to copy the code are as follows: -p num listening TCP port (default: 11211) - U num UDP listening port (default: 11211, closed at 0) -d Run as daemon...
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
在PHP中使用Memcache缓存常见问题及解决办法在PHP中使用Memcache缓存常见问题及解决办法May 16, 2023 am 09:07 AM

在Web应用中,缓存是一个非常重要的技术。缓存可以大大减少数据库和服务器的负载,提高Web应用的性能。Memcache是一种高性能的分布式内存缓存系统,常用于Web应用中。在PHP中使用Memcache缓存,有时会出现一些问题,本文将介绍这些问题及其解决办法。问题一:无法连接到Memcache服务器在使用Memcache缓存时,第一个遇到的问题可能是无法连接

利用Memcache缓存技术提高PHP应用的并发处理能力利用Memcache缓存技术提高PHP应用的并发处理能力May 18, 2023 am 08:12 AM

随着互联网的飞速发展,越来越多的应用程序需要面对大量的并发请求,如何提高应用的并发处理能力成为开发者们需要解决的问题。其中,利用Memcache缓存技术进行并发优化成为了相对较为流行的一种方案。Memcache是一种高效的缓存技术,适用于大型Web应用程序、数据库和分布式系统。其特点是将数据存储于内存中,以实现高速读写操作。在Web应用程序的数据访问过程中,

PHP应用中的Memcache缓存技术如何避免出现数据损坏PHP应用中的Memcache缓存技术如何避免出现数据损坏May 15, 2023 pm 10:01 PM

Memcache是一种在Web应用中常用的缓存技术,对于高并发的应用,它能够减轻数据库的压力,提高数据读取速度,降低系统响应时间。但是,在实际运用中,由于某些原因,会出现缓存数据被破坏的情况。本文主要从以下几个方面来讲述如何避免PHP应用中Memcache缓存技术出现数据损坏的情况。一、数据序列化通常情况下,我们将需要缓存的数据直接以对象形式存储到Memca

Memcache缓存技术在PHP项目中的应用和实践Memcache缓存技术在PHP项目中的应用和实践May 17, 2023 pm 02:10 PM

Memcache是一种开源的、分布式的缓存技术。它通过将数据存储在内存中,极大地提高了数据的访问速度,从而提升了网站的性能和响应速度。在PHP项目中,Memcache缓存技术也被广泛应用,并且取得了很好的效果。本篇文章将深入探讨Memcache缓存技术在PHP项目中的应用和实践。一、Memcache的原理和优势Memcache是一种内存缓存技术,它可以将数据

利用PHP中的Memcache缓存优化Gzip压缩算法利用PHP中的Memcache缓存优化Gzip压缩算法May 15, 2023 pm 04:31 PM

随着网络技术越来越发达,网站的访问量逐渐增多,为了提升用户体验,我们需要尽可能地减少网页的加载时间和传输数据的大小。其中,Gzip压缩算法是一种经典的数据压缩算法,可以在传输数据时将数据压缩,减少传输数据的大小,从而提升网页的加载速度和用户体验。在使用Gzip压缩算法来优化网站时,我们还可以结合PHP中的Memcache缓存技术来进一步提升网站的性能。一、G

如何使用PHP中的Memcache缓存技术提高网站的大并发性能如何使用PHP中的Memcache缓存技术提高网站的大并发性能May 17, 2023 pm 05:00 PM

随着互联网技术的不断发展,网站的用户访问量越来越大,带来的并发访问量也越来越高。为了应对这种高并发访问,常用的手段是使用缓存技术。而在PHP语言中,Memcache缓存技术是一种非常有效的解决方案。Memcache是一种分布式缓存系统,能够将大量的数据缓存在内存中,并能够从内存中快速读取,从而提高网站的响应速度和并发能力。在本文中,我们将介绍如何使用PHP中

Memcache缓存技术如何构建PHP中的缓存架构Memcache缓存技术如何构建PHP中的缓存架构May 15, 2023 pm 05:40 PM

随着互联网时代的到来,Web应用程序的访问量越来越大,同时性能也愈发成为用户优先考量因素之一。缓存技术因此应运而生。Memcache作为一种高性能、分布式的内存对象缓存系统,被广泛应用于Web开发中。在PHP中构建Memcache缓存架构,可大幅提升Web应用程序的性能和响应速度。下面我们将分为以下几个方面,阐述Memcache缓存技术在PHP中的构建方式。

使用PHP中的Memcache缓存技术提高Web应用的负载均衡效率使用PHP中的Memcache缓存技术提高Web应用的负载均衡效率May 15, 2023 pm 03:22 PM

随着互联网的普及和Web应用的广泛使用,面对高并发的访问压力,提高Web应用的负载均衡效率是必不可少的。在这样的背景下,缓存技术成为了提高Web应用效率的重要手段之一。而其中的Memcache缓存技术,以其高效、快速、易于使用等优点,逐渐成为了Web应用开发者们广泛采用的工具。那么,什么是Memcache缓存技术?它怎么使用?今天,我们就来探讨一下,如何使用

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools