From 8185d0d872d4b5380c2c76fa0a1b3ffa5fd2d4ab Mon Sep 17 00:00:00 2001 From: dab246 Date: Thu, 27 Apr 2023 11:31:09 +0700 Subject: [PATCH] Add `adr` for store cache (cherry picked from commit a4eb388ad9523675de6a28713e7f0fcce9b2f3f9) --- .../adr/0027-use-tuplekey-store-data-cache.md | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 docs/adr/0027-use-tuplekey-store-data-cache.md diff --git a/docs/adr/0027-use-tuplekey-store-data-cache.md b/docs/adr/0027-use-tuplekey-store-data-cache.md new file mode 100644 index 000000000..0a150312d --- /dev/null +++ b/docs/adr/0027-use-tuplekey-store-data-cache.md @@ -0,0 +1,21 @@ +# 5. Use TupleKey store data cache + +Date: 2023-04-27 + +## Status + +Accepted + +## Context + +- Multiple accounts login at the same time in the same browser. The accounts will use the same database (`IndexDatabase`). + +## Decision + +- Use unique parameters (`AccountId`, `UserName`, `ObjectId(MailboxId/EmailId/StateType`) to form a unique `key` for storage (called `TupleKey`). +- TupleKey has the format: `ObjectId | AccountId | User`; +- `HiveDatabase` includes many `Box`. Each box is a `Map` with `key=TupleKey`. + +## Consequences + +- The correct `mailbox` and `email` lists are obtained for each account