本文介绍了在Java中使用App Engine数据存储低级API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用低级API在App Engine数据存储库中找到实体类型中的条目总数?
我有一个函数或过滤器来查询此目的?
我正在使用Java来执行此操作。
解决方案
Engine有一个用于以编程方式获取数据存储区统计信息的API:
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
Entity globalStat = datastore.prepare(new Query(__ Stat_Total __))。asSingleEntity();
Long totalBytes =(Long)globalStat.getProperty(bytes);
Long totalEntities =(Long)globalStat.getProperty(count)
请参阅文档: https://cloud.google.com/appengine/docs/java/datastore/您可以使用 __ Stat_Kind __
来获取某种实体
How to find the total number of entries in an entity type in App Engine Datastore using Low Level API?
I there a function or filter to query for this purpose?
I am using Java to implement this.
解决方案
App Engine has an API for getting datastore statistics programmatically:
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
Entity globalStat = datastore.prepare(new Query("__Stat_Total__")).asSingleEntity();
Long totalBytes = (Long) globalStat.getProperty("bytes");
Long totalEntities = (Long) globalStat.getProperty("count")
See the documentation: https://cloud.google.com/appengine/docs/java/datastore/stats
You can get entities of a kind using __Stat_Kind__
这篇关于在Java中使用App Engine数据存储低级API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!