# Storage Comparison

Here’s a **visual comparison table** of the three server-side storage methods available in JENTIS: `userStorage`, `global userStorage`, and `toolInstanceStorage`. This table will help you choose the right storage type for your specific use case:

***

### Storage Scope Comparison

| Feature / Property                     | `userStorage` (Per Tool)                                               | `userStorage` (Global)                                                            | `toolInstanceStorage`                                       |
| -------------------------------------- | ---------------------------------------------------------------------- | --------------------------------------------------------------------------------- | ----------------------------------------------------------- |
| **Scope**                              | Per user, **per tool instance**                                        | Per user, **shared across all tools**                                             | **Shared across all users**, per tool instance              |
| **Shared Across Tools**                | <i class="fa-circle-xmark">:circle-xmark:</i> No                       | <i class="fa-square-check">:square-check:</i> Yes                                 | <i class="fa-circle-xmark">:circle-xmark:</i> No            |
| **Shared Across Users**                | <i class="fa-circle-xmark">:circle-xmark:</i> No                       | <i class="fa-circle-xmark">:circle-xmark:</i> No                                  | <i class="fa-square-check">:square-check:</i> Yes           |
| **Primary Use Case**                   | Store user-specific data like `client_id`, `gclid` for a specific tool | Store unified identifiers like `client_id` across multiple tools                  | Store shared secrets or tokens like `auth_token` for a tool |
| **Read/Write Interface**               | `this.userStorage.read("key")` / `write(...)`                          | `this.userStorage.read("key", true)` / `write(..., true)`                         | `this.toolInstanceStorage.read("key")` / `write(...)`       |
| **Delete Interface**                   | `this.userStorage.delete("key")`                                       | `this.userStorage.delete("key", true)`                                            | `this.toolInstanceStorage.delete("key")`                    |
| **Data Lifespan**                      | Controlled via expiration timestamp                                    | Controlled via expiration timestamp                                               | Controlled via expiration timestamp                         |
| **Supported in Server-Side Variables** | <i class="fa-square-check">:square-check:</i> Yes                      | <i class="fa-square-check">:square-check:</i> Yes                                 | <i class="fa-square-check">:square-check:</i> Yes           |
| **Global Flag Required**               | <i class="fa-circle-xmark">:circle-xmark:</i> No                       | <i class="fa-square-check">:square-check:</i> Yes (pass `true` as last parameter) | <i class="fa-circle-xmark">:circle-xmark:</i> No            |
| **Example Use**                        | Store `fbclid` for Tool A only                                         | Store `client_id` globally for all tools                                          | Store `access_token` for an API integration                 |

***

### Recommendations

| Goal                                               | Recommended Storage      |
| -------------------------------------------------- | ------------------------ |
| Store user-specific values for **a single tool**   | `userStorage` (per tool) |
| Store user-specific values **shared across tools** | `userStorage` (global)   |
| Store tool-specific data **shared across users**   | `toolInstanceStorage`    |

***

This comparison ensures that you select the correct storage mechanism depending on **who** the data belongs to (user vs. tool) and **how widely it needs to be shared** (tool-only, global, or cross-user).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.jentis.com/developer-guide/server-side-storage-interface/storage-comparison.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
