Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

To play with Memcached over Telnet, connect to its TCP listener (commonly localhost 11211), send one Basic Text Protocol command per line, and— for storage commands—send an exactly sized data block immediately afterward. The shortest useful session is:

telnet localhost 11211
set greeting 0 300 5
hello
get greeting
quit

Memcached is an in-memory key-value store for small chunks of arbitrary data, such as results from database calls, API calls, or page rendering. Telnet exposes the human-readable ASCII protocol, making it useful for learning, diagnostics, and quick checks.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What Telnet exposes in Memcached

Memcached’s Basic Text Protocol uses ASCII command lines. A retrieval command is a single line; a storage command is a command line followed by a byte-counted payload. The server responds with short status words or structured lines that you can read directly in a Telnet window.

The item fields

Every item has a key, a 32-bit flags value, an expiration time, a 64-bit CAS (compare-and-swap) value, and arbitrary data. In ASCII mode, a key is limited to 250 bytes and cannot contain spaces or newline characters.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application: attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Economical &Reusable: Built durable materials with a long-lasting battery,our CAGIWIRU air duster it's a sustainable alternative to disposable air cans.
  • An expiration of 0 means the item does not have a time-based expiration.
  • Values up to 30 days are interpreted as a number of seconds from now.
  • A value greater than 30 days is interpreted as a Unix timestamp.
  • The bytes field in a storage command must equal the payload length exactly, measured in bytes rather than characters.

Connect and frame commands correctly

Open a Telnet session

Use the host and port where Memcached is listening. The conventional local endpoint is port 11211:

$ telnet localhost 11211
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

If the service is on another host, replace localhost with that host name or address. A connection only proves that the TCP port accepted you; commands still have to follow the protocol.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Terminate each line with CRLF

Memcached expects carriage-return/line-feed (CRLF) line endings. A storage request has this exact shape:

<command> <key> <flags> <exptime> <bytes> CRLF
<data bytes> CRLF

For cas, add the CAS token after the byte count:

cas <key> <flags> <exptime> <bytes> <cas unique> CRLF
<data bytes> CRLF

In the examples below, each displayed command and payload line is followed by CRLF when you type or transmit it. Do not send extra spaces, omit the payload terminator, or claim a byte count that differs from the data.

Play with telnet: get foo and inspect stats

Read a key with get

The get command accepts one or more keys. A hit returns a VALUE header, the payload, and a final END line. A missing key produces only END.

get foo
VALUE foo 0 3
bar
END

The fields in the VALUE header are the key, flags, and payload length. If you request several keys, Memcached returns a block for every hit and then one END marker.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth

Inspect the server with stats

Send stats with no argument for counters and settings:

stats
STAT pid 1234
STAT uptime 456
END

The names and values depend on the running instance. Two useful focused forms are:

stats items
stats slabs

stats items summarizes items by slab class, while stats slabs reports slab details. stats sizes exists as a development diagnostic, but it can lock a busy instance; use it only when that operational risk is acceptable.

Store and retrieve values

set: create or overwrite

set always writes the supplied value, whether or not the key already exists. This example stores five bytes for 300 seconds with flags set to zero:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
set greeting 0 300 5
hello
STORED
get greeting
VALUE greeting 0 5
hello
END

The command line says: key greeting, flags 0, relative expiration 300 seconds, and a five-byte payload. The server’s STORED response confirms success.

add: write only when absent

add succeeds only if the key does not currently exist. It is useful for one-time initialization and lock-like attempts:

Rank #3
Sale
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black | LED mouse pad with 14 lighting modes, covers keyboard & mouse, anti-slip rubber base, waterproof surface, USB powered
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.
add lock 0 60 4
busy
STORED
add lock 0 60 5
again
NOT_STORED

The second request fails because lock is already present. A failed conditional write does not replace the existing payload.

replace: write only when present

replace has the opposite existence rule: the key must already exist.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
replace greeting 0 300 5
hello
STORED
replace missing 0 300 5
hello
NOT_STORED

The first request updates an existing item; the second does nothing because missing is absent.

Modify existing bytes with append and prepend

append adds bytes to the end of an existing item, while prepend adds bytes to its beginning. Neither command accepts new flags or expiration settings: both retain the item’s existing metadata.

append greeting 0 0 6
 world
STORED
prepend greeting 0 0 5
Say: 
STORED
get greeting
VALUE greeting 0 16
Say: hello world
END

Here, the original five-byte value becomes eleven bytes after appending, then sixteen bytes after prepending. The flags and expiration remain those of the original item. The byte count for append or prepend describes only the new fragment, not the complete resulting value.

Prevent lost updates with gets and cas

A plain get does not provide a version token. When multiple clients read and write the same key, one client can overwrite another’s change. Use gets to retrieve the current CAS identifier, then submit that identifier with cas.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.
gets greeting
VALUE greeting 0 16 42
Say: hello world
END
cas greeting 0 300 15 42
Say: hello again
STORED

The extra number on the VALUE line is the CAS token. Memcached stores the new value only if token 42 is still current. If another writer changed the item after the gets, the token is stale and the server returns EXISTS instead of overwriting that newer value. Fetch a fresh token with gets before trying again.

Delete one key

delete removes a single key if it exists:

delete greeting
DELETED
delete greeting
NOT_FOUND

The first command removes the item. The second reports that no item with that key remains.

Use incr and decr for numeric counters

Counter commands operate on an existing value containing an unsigned 64-bit decimal integer. They do not create a missing key.

set hits 0 3600 1
0
STORED
incr hits 1
1
decr hits 1
0

The argument after the key is the amount to add or subtract. If the key is absent, the response is NOT_FOUND; initialize it with set first. Decrement underflow clamps at zero. Increment overflow wraps at 64 bits, so applications should choose a counter policy that tolerates that behavior.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Invalidate cached data with flush_all

flush_all invalidates existing items:

flush_all
OK

You can schedule invalidation rather than doing it immediately:

flush_all 60
OK

The number is a delay in seconds. Flushing causes items to expire; it does not itself free memory or pause the server. Because it affects the entire cache, use it deliberately rather than as a routine way to remove one bad key.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Finish the session

Send quit to close the interactive protocol session:

quit

You can also use Telnet’s escape sequence to leave the client. A normal TCP close is sufficient after the server has processed your final response.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Command comparison

Command Purpose Existence or concurrency rule Typical success response
get Read one or more values Returns only keys that exist VALUE ..., payload, then END
gets Read values with CAS tokens Returns the current version token VALUE ... <cas unique>, payload, then END
set Create or overwrite No existence requirement STORED
add Create only Fails when the key exists STORED
replace Update only Fails when the key is absent STORED
append Add bytes at the end Requires an existing key; keeps metadata STORED
prepend Add bytes at the beginning Requires an existing key; keeps metadata STORED
cas Conditional update Requires an existing, current CAS token STORED
delete Remove one key Reports whether the key was present DELETED
incr/decr Change a decimal counter Requires an existing unsigned 64-bit integer New decimal value
stats Inspect counters and slab information Read-only diagnostic operation STAT ... lines, then END
flush_all Invalidate the cache Affects all existing items, immediately or after a delay OK

Understand Memcached responses

  • STORED — the storage operation succeeded.
  • NOT_STORED — a conditional storage operation could not proceed, commonly because add found an existing key or replace found none.
  • EXISTS — the CAS token supplied to cas is stale.
  • NOT_FOUND — the key is absent for a retrieval-style mutation, deletion, or counter operation.
  • VALUE ... followed by payload — a retrieval hit; END marks the end of the response.
  • CLIENT_ERROR — the request is malformed, the key is invalid, or the framing is wrong.
  • SERVER_ERROR — the server encountered an internal failure.

Fix common Telnet mistakes

The server waits after a storage command

Check that you sent the payload and its terminating CRLF. Memcached will continue waiting if the declared byte count has not arrived. Count bytes exactly; for plain ASCII examples, the character count and byte count match, but they can differ for multibyte text.

You receive CLIENT_ERROR

Verify the command spelling and field order, remove spaces or newline characters from the key, and recalculate the payload length. A malformed header and a mismatched byte count are the usual framing causes.

add or replace returns NOT_STORED

That response is a condition result, not a transport failure. add refuses an already existing key; replace refuses an absent key. Use get to inspect the current state before choosing the operation.

cas returns EXISTS

Another writer changed the item after your gets. Read it again with gets, merge or recalculate your update, and retry with the new token.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

incr or decr returns NOT_FOUND

Counters are not auto-created. Initialize the key with set and a decimal value, then issue the counter command.

Responses become impossible to match to requests

Do not use noreply while learning or debugging. Suppressing responses can leave the client and server out of alignment when a command is malformed, making the next output appear to belong to the wrong request.

Basic Text Protocol scope

Memcached documentation also describes a newer Meta Text Protocol. The older binary protocol is deprecated. Telnet examples in this guide intentionally stay with the Basic Text Protocol because it is the line-oriented interface you can inspect directly in an interactive session. Use a client library for application code, where connection handling, byte encoding, retries, and concurrency are easier to control.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.