Persistent Storage
This document introduces the persistent storage functionality in Dify plugins, detailing how to use the KV database in plugins to store, retrieve, and delete data. This feature enables plugins to persistently store data within the same Workspace, meeting the needs for data preservation across sessions.
When examining Tools and Endpoints in plugins individually, it’s not difficult to see that in most cases, they can only complete single-round interactions: request, return data, and the task ends.
If there is data that needs to be stored long-term, such as implementing persistent memory, the plugin needs to have persistent storage capabilities. The persistent storage mechanism allows plugins to have the ability to persistently store data within the same Workspace. Currently, a KV database is provided to meet storage needs, and more flexible and powerful storage interfaces may be introduced in the future based on actual usage.
Storing Keys
Entry Point
Interface
Note that what is passed in is bytes, so you can actually store files in it.