From 83e008e4e9013e31606abbecb7c2935a1d346d13 Mon Sep 17 00:00:00 2001 From: Abdulla Abdurakhmanov Date: Sat, 20 Jan 2024 21:51:13 +0100 Subject: [PATCH] Revert "Example update" This reverts commit da671c12803a10d635169bb6f86ffcaeeb4d3a00. --- examples/caching_memory_collections.rs | 40 +++++++++++++------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/examples/caching_memory_collections.rs b/examples/caching_memory_collections.rs index 00829f7..1126387 100644 --- a/examples/caching_memory_collections.rs +++ b/examples/caching_memory_collections.rs @@ -119,35 +119,36 @@ async fn main() -> Result<(), Box> { println!("{:?}", my_struct2); println!("Getting batch by ids"); + let cached_db = db.read_through_cache(&cache); - let my_struct1_stream: BoxStream)>> = db - .read_through_cache(&cache) - .fluent() - .select() - .by_id_in(TEST_COLLECTION_NAME) - .obj() - .batch_with_errors(["test-1", "test-2"]) - .await?; + let my_struct1_stream: BoxStream)>> = + cached_db + .fluent() + .select() + .by_id_in(TEST_COLLECTION_NAME) + .obj() + .batch_with_errors(["test-1", "test-2"]) + .await?; let my_structs1 = my_struct1_stream.try_collect::>().await?; println!("{:?}", my_structs1); // Now from cache - let my_struct2_stream: BoxStream)>> = db - .read_through_cache(&cache) - .fluent() - .select() - .by_id_in(TEST_COLLECTION_NAME) - .obj() - .batch_with_errors(["test-1", "test-2"]) - .await?; + let my_struct2_stream: BoxStream)>> = + cached_db + .fluent() + .select() + .by_id_in(TEST_COLLECTION_NAME) + .obj() + .batch_with_errors(["test-1", "test-2"]) + .await?; let my_structs2 = my_struct2_stream.try_collect::>().await?; println!("{:?}", my_structs2); // List from cache - let all_items_stream = db - .read_cached_only(&cache) + let cached_db = db.read_cached_only(&cache); + let all_items_stream = cached_db .fluent() .list() .from(TEST_COLLECTION_NAME) @@ -159,8 +160,7 @@ async fn main() -> Result<(), Box> { println!("{:?}", listed_items.len()); // Query from cache - let all_items_stream = db - .read_cached_only(&cache) + let all_items_stream = cached_db .fluent() .select() .from(TEST_COLLECTION_NAME)