【清理旧的googleappengine会话】敢说敢作敢为, 无怨无恨无悔。这篇文章主要讲述清理旧的googleappengine会话相关的知识,希望能为你提供帮助。
- 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( ) ;
- }
推荐阅读
- KickApps-更改表单验证以使用JQuery。修复IE的问题
- KickApps-告诉用户是否已登录
- 从Android应用程序启动电话
- Android的OpenGL教程(构建Mandelbrot集生成器)
- 适用于开发人员的Android M(Android 6.0)(朝着正确方向发展的一步)
- OpenCV教程(在iOS中使用MSER进行实时对象检测)
- Android自定义(如何构建可以满足你需求的UI组件)
- 强制触摸对UI和UX意味着什么()
- 正在为Android Auto和Apple Carplay之类的汽车信息娱乐系统开发下一件大事吗()