DISQUS

Benjamin Golub's Blog: Google App Engine + Memcached + FF To Go = Bliss

  • ericflo · 1 year ago
    I think you might be better off caching the entire response, as then subsequent requests don't even have to go through the template system, context processors, etc.

    For example:

    ...
    key = 'public_%i_%i_%s' % (num, start, service)
    response = memcache.get(key)
    if not response:
    try:
    data = f.fetch_public_feed(num=num, start=start, service=service)
    except Exception, e:
    return HttpResponseRedirect('/%s/' % e)
    extra_context = {
    'entries': data['entries'],
    ‘next’: start + num,
    }
    if start > 0:
    extra_context['has_previous'] = True
    extra_context['previous'] = start - num
    response = render_to_response(’public.html’, extra_context, context_instance=RequestContext(request))
    memcache.set(key, response, CACHE_TIME)
    return response
  • ericflo · 1 year ago
    Sorry, Disqus is not so great for code snippets :(
  • Benjamin Golub · 1 year ago
    It's a little trickier than that; because the user can also set the font size and the header contains a link to the user's friendfeed page. But yes; this is exactly what I do on RSSmeme (and as I'm sure you are aware it's how the Django cache middleware works). I cache the entire response (I also cache the results from the DB so hitting the html and then the API for the same data doesn't result in 2 DB requests). Since this runs on Google App Engine and the CPU is not a bottleneck at all I'm not worried about the time spent on the template system too much.

    But thanks!
  • ericflo · 1 year ago
    Ahh I see--foot, meet mouth :) Still, it's cool stuff.
  • linkso0flondon · 2 months ago
    Kate Middleton, the girlfriend of British Prince William for 8 years, is regarded as a modern version of Cinderella. links of london The romantic relationship between her and her royal beau catches great attention. links of london And she is even expected to be a second Princess Diana. links of london Being similar to Princess Diana, she also has a simple background with an ordinary family, but has extraordinary inherent quality and temperature. links of london Nevertheless, it never stops her to behave decently as the girl of Prince since she established a relationship with William in 2003. links of london With a good taste in fashion, Kate wins popularity of the public and becomes the fashion icon of many young ladies. links of london Her special temperature could be showed totally even just with a pair of simple links of london earrings. links of london Recently, it is expected by British media that the Prince and her girlfriend Kate will become man and wife sooner rather than later. links of london links of londonBecause she has been invited to a private lunch with the Queen at the summer retreat Balmoral over the august bank holiday to have a heart-to-heart alone. links of london Although Kate has dinner with the Queen alongside William before, this will be the first time she has lunched alone with the royal grandma. links of london According to "royal watchers", this invitation is a "significant step" in the young couple's relationship. links of london links of londonSomething else will be discussed as well, such as what kind of changes will happen to her if she marries the Prince. links of london Are Kate and William suited to each other? Just focus their future development. links of london