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"]],["上次更新時間:2025-06-16 (世界標準時間)。"],[[["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."]]],[]]