Google News
logo
Memcached - Interview Questions
How to get the versions in Memcached?
To get the version information of a Memcached server, you can use the "version" command. Here's how you can retrieve the version information using Telnet or a Memcached client library:

1. Using Telnet : Open a terminal and use Telnet to connect to the Memcached server on the default port (11211). Then, send the "version" command to the server. Here's an example:
telnet localhost 11211
version?

After sending the "version" command, the server will respond with its version information.


2. Using Memcached Client Library : If you're using a programming language such as Python, Java, or PHP, you can use a Memcached client library to interact with the Memcached server programmatically. Here's an example using Python's python-memcached library:
import memcache

# Connect to Memcached server
client = memcache.Client(['localhost:11211'])

# Get version information
version_info = client.get_stats('version')
print(version_info)?

This code connects to the Memcached server running on localhost and retrieves the version information using the get_stats('version') method.

Regardless of the method you choose, the Memcached server will respond with its version information, which typically includes details such as the Memcached version number and any additional information about the server environment.
Advertisement