Complete the code to import the cache object from Django's cache framework.
from django.core.cache import [1]
caches instead of cache when only one cache is used.cache_control which is unrelated.The cache object is imported from django.core.cache to use the low-level cache API.
Complete the code to set a cache key 'greeting' with value 'hello' that expires in 30 seconds.
cache.[1]('greeting', 'hello', timeout=30)
get which only retrieves data.delete which removes data.The set method stores a value in the cache with an optional timeout.
Fix the error in the code to retrieve the value of cache key 'greeting'.
value = cache.[1]('greeting')
set which stores data instead of retrieving.fetch which is not a valid cache method.The get method retrieves the value stored under a cache key.
Fill both blanks to delete a cache key 'greeting' and then clear all cache keys.
cache.[1]('greeting') cache.[2]()
set or get instead of delete or clear.The delete method removes a specific cache key, and clear removes all keys.
Fill all three blanks to add a cache key 'counter' with value 1 only if it does not exist, then increment it by 1.
cache.[1]('counter', 1) counter = cache.[2]('counter') counter = counter [3] 1
set instead of add which overwrites existing keys.The add method sets a key only if it does not exist. Then get retrieves it, and + increments the value.