doubledeadline=5.0;// Construct a read policy for eventual consistencyReadPolicypolicy=newReadPolicy(ReadPolicy.Consistency.EVENTUAL);// Set the read policyDatastoreServiceConfigeventuallyConsistentConfig=DatastoreServiceConfig.Builder.withReadPolicy(policy);// Set the call deadlineDatastoreServiceConfigdeadlineConfig=DatastoreServiceConfig.Builder.withDeadline(deadline);// Set both the read policy and the call deadlineDatastoreServiceConfigdatastoreConfig=DatastoreServiceConfig.Builder.withReadPolicy(policy).deadline(deadline);// Get Datastore service with the given configurationDatastoreServicedatastore=DatastoreServiceFactory.getDatastoreService(datastoreConfig);
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-03-06。"],[[["This API supports first-generation runtimes and is relevant when upgrading to second-generation runtimes, while migration to Java 11/17 requires a separate migration guide."],["Datastore queries offer two consistency levels: strongly consistent queries, which guarantee the freshest results but may be slower, and eventually consistent queries, which are generally faster but may return stale results."],["Ancestor queries are strongly consistent by default but can be set to eventually consistent, while non-ancestor queries are always eventually consistent."],["The Datastore read policy can be set to eventually consistent to improve performance, and the call deadline can be adjusted to control the maximum wait time for a Datastore operation."],["Developers can use the `DatastoreServiceConfig` to set the read policy and/or the call deadline for Datastore operations, using the `ReadPolicy` for consistency and `withDeadline` for the time limit, and can use the `DatastoreServiceFactory` to get a `DatastoreService` instance with the desired configuration."]]],[]]