views:

24

answers:

1

Hi,

I have a app engine app (java) which renders a page. It fetches data to generate the page, something like:

// index.jsp
<%
  List<Horse> horses = datastore.getHorses(PMF.get());
  List<Horse> cows = datastore.getCows(PMF.get());
  List<Horse> goats = datastore.getGoats(PMF.get());

  for (Horse it : horses) {
      %>
      <div><%= it.getName() %></div>
      <%
  }
  .. same for cows and goats arrays ...
%>

this works perfectly well, but my app is doing three fetches to the datastore every time a user loads this page.

The content of the fetched arrays does not change often, so it would be great if I could somehow cache the page so that it requires only a single read from the datastore. I can do this manually, but it's a lot of work to implement. Just wondering if there's anything like this already implemented? For example, all those arrays belong to the same entity group, so I could precompute the first page of each, store it as a Text property of the parent, and just read that until one of them changes, then recompute,

Thanks

+1  A: 

http://www.memcached.org/

EDIT: Just re-read and saw appEngine, sorry

http://code.google.com/appengine/docs/python/memcache/usingmemcache.html

Taylor
Ah ok this indeed looks like the way to go, thanks.