---
title: Persistent Storage
---



{/* 
  CONTRIBUTOR NOTE:
  ----------------
  This is a legacy document that is being deprecated.
  Please DO NOT make changes to this version.
  All updates should be directed to the new version at:
  /plugin-dev-en/0411-persistent-storage-kv
*/}

<Card title="This Documentation is Being Deprecated" icon="circle-exclamation" href="/plugin-dev-en/0411-persistent-storage-kv">
  <p>This page is being phased out as part of our documentation reorganization.</p>
  
  <p><strong>Click this card</strong> to be redirected to the updated version with the most current information.</p>
  
  <p>If you notice any discrepancies or areas needing improvement in the new documentation, please use the "Report an issue" button at the bottom of the page.</p>
</Card>

If you look at the Tool and Endpoint in the plug-in alone, it is not difficult to find that in most cases it can only complete a single round of interaction, the request returns the data, and the task ends.

If there is a need for long-term storage of data, such as the implementation of persistent memory, the plug-in needs to have persistent storage capabilities. **Persistent storage mechanism allows plugins to have the ability to store data persistently in the same Workspace** , currently through the provision of KV database to meet the storage needs , the future may be based on the actual use of the introduction of more flexible and more powerful storage endpoints .

### Storage Key

#### **Entrance**

```python
    self.session.storage
```

#### Endpoints

```python
    def set(self, key: str, val: bytes) -> None:
        pass
```

You can notice that a bytes is passed in, so you can actually store files in it.

### Get Key

#### **Entrance**

```python
    self.session.storage
```

#### **Endpoint**

```python
    def get(self, key: str) -> bytes:
        pass
```

### Delete Key

#### **Entrance**

```python
    self.session.storage
```

#### **Endpoint**

```python
    def delete(self, key: str) -> None:
        pass
```

{/*
Contributing Section
DO NOT edit this section!
It will be automatically generated by the script.
*/}

---

[Edit this page](https://github.com/langgenius/dify-docs/edit/main/en/plugins/schema-definition/persistent-storage.mdx) | [Report an issue](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml)

