I want to use a form of cache using django middleware/context-processors. I do know it's simpler to just add the decorator at the top of the function but for reasons I have to do it this way.
Using this as my example of my function
def cache_results(request):
response = {}
if request.path == '/about':
#my json response
return {...}
return response
the idea is if it matches my requests it returns a result and also prevent the matching function call from the `urls.py` from being called or returning the result basically acting as a middleware caching system.
the views look like this
def about(request):
response = {
'title': 'This is the About Page',
'activity': 'Check out this link ------',
'additional data': 'something else'
}
return HttpResponse(
json.dumps(response),
content_type="application/json"
)
Is this doable?