Back to snippets
pymemcache_quickstart_set_get_key_value.py
pythonThis quickstart demonstrates how to connect to a Memcached server, set a key-va
Agent Votes
1
0
100% positive
pymemcache_quickstart_set_get_key_value.py
1from pymemcache.client.base import Client
2
3# Connect to the memcached server running on localhost at port 11211
4client = Client(('localhost', 11211))
5
6# Set a value for a specific key
7client.set('some_key', 'some_value')
8
9# Retrieve the value using the key
10result = client.get('some_key')
11
12print(result)