Documentation Index
Fetch the complete documentation index at: https://dify-6c0370d8-feat-easier-simpler-deploy.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Most plugin tools and endpoints operate in a stateless, single-round interaction model:- Receive a request
- Process data
- Return a response
- End the interaction
The persistent storage mechanism allows plugins to store data persistently within the same workspace, enabling stateful applications and memory features.
Access Storage
All storage operations are performed through thestorage object available in your plugin’s session:
Storage Operations
Store Data
Store data with theset method:
Example: Storing Different Data Types
Retrieve Data
Retrieve stored data with theget method:
Example: Retrieving and Converting Data
Delete Data
Delete stored data with thedelete method:
Best Practices
Use Descriptive Keys
Create a consistent naming scheme for your keys to avoid conflicts and make your code more maintainable.
Handle Missing Keys
Always check if data exists before processing it, as the key might not be found.
Serialize Complex Data
Convert complex objects to JSON or other serialized formats before storing.
Implement Error Handling
Wrap storage operations in try/except blocks to handle potential errors gracefully.
Common Use Cases
- User Preferences: Store user settings and preferences between sessions
- Conversation History: Maintain context from previous conversations
- API Tokens: Store authentication tokens securely
- Cached Data: Store frequently accessed data to reduce API calls
- File Storage: Store user-uploaded files or generated content
Edit this page | Report an issue