Bird
0
0

Which of the following is the correct Django settings.py configuration snippet to use Memcached with the PyMemcache client?

easy📝 Syntax Q3 of 15
Django - Caching
Which of the following is the correct Django settings.py configuration snippet to use Memcached with the PyMemcache client?
A"BACKEND": "django.core.cache.backends.redis.RedisCache", "LOCATION": "127.0.0.1:11211"
B"BACKEND": "django.core.cache.backends.memcached.MemcachedCache", "LOCATION": "127.0.0.1:6379"
C"BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache", "LOCATION": "127.0.0.1:11211"
D"BACKEND": "django.core.cache.backends.locmem.LocMemCache", "LOCATION": "127.0.0.1:11211"
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct backend class for PyMemcache

    PyMemcacheCache is the correct backend for Memcached using PyMemcache client.
  2. Step 2: Verify location port

    Memcached default port is 11211, not 6379 (which is Redis).
  3. Final Answer:

    "BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache", "LOCATION": "127.0.0.1:11211" -> Option C
  4. Quick Check:

    Memcached uses port 11211 and PyMemcacheCache backend [OK]
Quick Trick: Memcached default port is 11211, Redis is 6379 [OK]
Common Mistakes:
MISTAKES
  • Using Redis port with Memcached backend
  • Confusing backend class names

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes