# unique\_entries

## Why this table exists?

This table is used to store data that is regularly called by the users. For example, price data for a mandi-crop-date combination. Instead of quering this each time a user ask this data, we can do it once and store it in this table from where we can fetch it easily. This reduces load on the system and help us to send respnse much faster. To know more on how this table is used, you can read [here](/bolbhav/chapter-5-crop-price-viewing/cache-memory.md).&#x20;

## Model

<table><thead><tr><th>Field</th><th>Type</th><th data-type="checkbox">Nullable</th></tr></thead><tbody><tr><td>_id</td><td>varchar</td><td>false</td></tr><tr><td>_type</td><td>int4</td><td>true</td></tr><tr><td>data</td><td>varchar</td><td>true</td></tr><tr><td>created_at</td><td>timestamp</td><td>true</td></tr><tr><td>updated_at</td><td>timestamp</td><td>true</td></tr><tr><td>payload</td><td>json</td><td>true</td></tr><tr><td>user_id</td><td>int4</td><td>true</td></tr></tbody></table>

## Description

#### \_id

This is the primary key and unique identifier of the entry. This serves as a cache key to fetch the cache payload value.

#### \_type

This is being used to mark the type of the unique entry.

{% hint style="info" %}
We might need to rethink the purpose of this field and possibly rename or replace it with a more meaningful data.
{% endhint %}

#### data

This was an old field. Not being used anymore.

#### created\_at

Timestamp when the entry was created.

#### updated\_at

Timestamp when the entry was last updated.

#### payload

The value stored against the key. This is a JSON field and can hold different information based on the entry. For example, an OTP value is stored like this:

```json
{"otp": "04783", "count": 1}
```

#### user\_id

The ID of the user. This field isn't being used from any active module.

{% hint style="danger" %}
This field can be removed.
{% endhint %}

## Example

<table><thead><tr><th width="451">id</th><th>Type</th><th>user_id</th></tr></thead><tbody><tr><td>mandi_prices_hi__326</td><td>1</td><td></td></tr><tr><td>mobile_number_otp__919090430991</td><td>1</td><td></td></tr><tr><td>mandi_crops_web_frequent__110</td><td>2</td><td></td></tr><tr><td>mandi_calender__118</td><td>3</td><td></td></tr><tr><td>location_crop_prices__1124_3</td><td>4</td><td></td></tr><tr><td>mandi_review_stats__904</td><td>5</td><td></td></tr><tr><td>mandi_all_details_web__470</td><td>6</td><td></td></tr><tr><td>mandi_crop_price_trends_hi__134_30</td><td>`7</td><td></td></tr><tr><td>crop_all_details_web__62</td><td>8</td><td></td></tr><tr><td>all_referral__34141</td><td>9</td><td></td></tr><tr><td>referral__FG502</td><td>10</td><td></td></tr><tr><td>referral_ranks__10</td><td>11</td><td></td></tr><tr><td>cs_mandi_price_broadcast_evenin</td><td>12</td><td></td></tr><tr><td>referral__MCMIX</td><td>13</td><td></td></tr><tr><td>missing_entries</td><td>14</td><td></td></tr><tr><td>random_user_auth__ff91b6c7-0c63-4fc8-bd6b-c56907046db9</td><td>15</td><td></td></tr><tr><td>cs_mandi_crop__20_3_28-07-2023</td><td>16</td><td></td></tr><tr><td>cs_mandi__20_18-08-2023</td><td>17</td><td></td></tr><tr><td>cs_mandi_data_no_price__29_28-10-2023</td><td>18</td><td></td></tr><tr><td>-</td><td>19</td><td></td></tr><tr><td>debit_from_membership_wallet_for_old_membership_2024-02-23</td><td>20</td><td></td></tr><tr><td>trader_crop_114_12-02-2024</td><td>21</td><td></td></tr><tr><td>trader_parent_crop_272_17-02-2024</td><td>22</td><td></td></tr><tr><td>trader_crop_mandi_116_08-02-2024</td><td>23</td><td></td></tr><tr><td>trader_mandi_20_crop_232_12-02-2024</td><td>24</td><td></td></tr></tbody></table>


---

# 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://gramhal.gitbook.io/bolbhav/chapter-1-database/cache-data/unique_entries.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.
