I have the list of city names of my country in my database. It is so
rare to add a new city. The list is the same for every user for every
session. So I use cache for the list. I want to read the list from DB
only for once and to keep it on cache as long as possible.
Do I need the following everytime I need cache object?
try {
CacheFactory cacheFactory =
CacheManager.getInstance().getCacheFactory();
cache = cacheFactory.createCache(Collections.emptyMap());
} catch (CacheException e) {
// ...
}
Or is it ok to save it with
getServletContext().setAttribute("cache", cache);
and get it with when I need it?
getServletContext().getAttribute("cache")
or can I keep it on a static field of MyServlet class?
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.