{"library":"python-memcached","title":"python-memcached Client","description":"python-memcached is a pure Python client for the memcached memory cache daemon. It provides a simple interface for storing and retrieving key-value pairs in one or more memcached servers. Currently at version 1.62, the library is stable but largely in maintenance mode, with `pymemcache` being suggested as a more actively developed alternative. Releases are infrequent but the project is still maintained.","language":"python","status":"maintenance","last_verified":"Fri May 15","install":{"commands":["pip install python-memcached"],"cli":null},"imports":["from memcache import Client"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import memcache\nimport os\n\n# Connect to a memcached server. Use environment variable for host if available.\n# Default to localhost:11211 if MEMCACHED_SERVER is not set.\nMEMCACHED_SERVER = os.environ.get('MEMCACHED_SERVER', '127.0.0.1:11211')\nmc = memcache.Client([MEMCACHED_SERVER], debug=0)\n\n# Set a key-value pair with an expiration time of 60 seconds\nmc.set(\"my_key\", \"Hello, Memcached!\", time=60)\nprint(f\"Set 'my_key': 'Hello, Memcached!' (expires in 60s)\")\n\n# Get the value for the key\nvalue = mc.get(\"my_key\")\nprint(f\"Got 'my_key': {value}\")\n\n# Set a complex object (will be pickled by default)\nsample_object = {\"name\": \"Test User\", \"id\": 123}\nmc.set(\"user_data\", sample_object)\nprint(f\"Set 'user_data': {sample_object}\")\n\n# Retrieve the complex object\nretrieved_object = mc.get(\"user_data\")\nprint(f\"Got 'user_data': {retrieved_object}\")\n\n# Delete a key\nmc.delete(\"my_key\")\nprint(f\"Deleted 'my_key'.\")\n\n# Try to get deleted key\ndeleted_value = mc.get(\"my_key\")\nprint(f\"Attempt to get 'my_key' after deletion: {deleted_value} (should be None)\")","lang":"python","description":"This quickstart demonstrates how to connect to a Memcached server, set and retrieve string values, store and retrieve Python objects (which are automatically pickled/unpickled), and delete keys using `python-memcached`.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-15","installed_version":"1.62","pypi_latest":"1.62","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":1.6,"avg_import_s":0.01,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"python-memcached","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.01,"mem_mb":1,"disk_size":"17.9M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"python-memcached","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.5,"import_time_s":0.01,"mem_mb":1,"disk_size":"18M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"python-memcached","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.02,"mem_mb":1.1,"disk_size":"19.7M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"python-memcached","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.6,"import_time_s":0.02,"mem_mb":1.1,"disk_size":"20M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"python-memcached","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.02,"mem_mb":0.7,"disk_size":"11.6M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"python-memcached","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.4,"import_time_s":0.01,"mem_mb":0.7,"disk_size":"12M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"python-memcached","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.01,"mem_mb":0.9,"disk_size":"11.3M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"python-memcached","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.5,"import_time_s":0.01,"mem_mb":0.7,"disk_size":"12M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"python-memcached","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.01,"mem_mb":1,"disk_size":"17.4M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"python-memcached","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.8,"import_time_s":0.01,"mem_mb":1,"disk_size":"18M"}]}}