1. Start
Run command prompt as administrator
Run directly: memcached.exe
Install/uninstall service: memcached.exe -d install/uninstall
Start/stop the service: memcached.exe -d start/stop
Default port: 11211; it is recommended not to change it, it can be modified through the registry
2. Use telnet to operate
Connect to telnet 192.168.1.31 11211 or telnet localhost 11211
Commands mainly use set, get, delete
You will use the five basic memcached commands to perform the simplest operations. These commands and actions include:
set
add
replace
get
delete
The first three commands are standard modification commands for manipulating key-value pairs stored in memcached. They are all very simple and easy to use, and both use the following syntax:
command <key> <flags> <expiration time> <bytes> <value> |
memcached modifies command parameters and usage.
parameter | usage |
---|---|
key | key is used to look up the cached value |
flags | An integer parameter that can include key-value pairs, which the client uses to store additional information about the key-value pair (additional information) |
expiration time | The length of time (in seconds, 0 means forever) to keep key-value pairs in the cache |
bytes | Byte points stored in the cache (number of bytes occupied) |
value | Stored value (always on second row) |
3. The use of memcache in C#
Commons.dll ,ICSharpCode.SharpZipLib.dll,log4net.dll,Memcached.ClientLibrary.dll
Add mmHelper.cs to the project and modify the configuration file
MmHelper mmHelper = new MmHelper(); mmHelper.Set(key, userLogin, DateTime.Now.AddMinutes(20));