I've got a query set up that puts 28 random records from a database into a JSON response. This page is hit often, every few seconds, but is currently too slow for my liking.
In the JSON response I have:
These all come from three linked tables.
I'd be keen to hear of some other solutions, instead of users simply hitting a page, looking up 28 random records and spitting back the response. One idea I had:
Is this a good option? If so, I'd be keen to hear how this would be done.
Thanks again,
Hope everyone is well
Django supports a variety of caching methods, both built-in and memcached. I would select one of the methods in the documentation, and create a specific view for your json response. You could then use the @cache_page decorator and specify a particular time.
from django.views.decorators.cache import cache_page
@cache_page(60 * 15)
def my_view(request):
...