Revision: 25623
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 3, 2010 07:34 by putrakopo
Initial Code
private void clearSessions() {
DatastoreService datastore =
DatastoreServiceFactory.getDatastoreService();
Query query = new Query("_ah_SESSION");
PreparedQuery results = datastore.prepare(query);
log.info("Deleting " + results.countEntities() + " sessions from
data store");
for (Entity session : results.asIterable()) {
datastore.delete(session.getKey());
}
}
// clearing everything in the cache, because sessions are also kept in
memcache
private void clearCache() throws CacheException {
CacheFactory cacheFactory = CacheManager.getInstance
().getCacheFactory();
Cache cache = cacheFactory.createCache(Collections.emptyMap());
CacheStatistics stats = cache.getCacheStatistics();
log.info("Clearing " + stats.getObjectCount() + " objects in
cache");
cache.clear();
}
Initial URL
http://groups.google.com/group/google-appengine-java/browse_thread/thread/280c3fb95dac2314
Initial Description
Initial Title
Cleaning up old Google Appenggine sessions
Initial Tags
java
Initial Language
Java