Retrieve Memory
Retrieve stored data from the 0G decentralized storage network.Method
Parameters
string
required
The unique identifier of the memory entry to retrieve
Response
Returns aMemoryEntry object if found, or null if the key doesn’t exist.
MemoryEntry Properties
string
The unique identifier of the entry
any
The stored data (automatically deserialized)
Record<string, any>
Additional metadata associated with the entry
string[]
Tags associated with the entry
Date
When the entry was stored
number
Time-to-live in seconds (if set)
Date
When the entry expires (if TTL is set)
Examples
Advanced Usage
Conditional Retrieval
Version Management
Cache Pattern
Integration Patterns
Chat Context Retrieval
User Profile Management
Configuration Management
Error Handling
Performance Optimization
Parallel Retrieval
Selective Loading
Best Practices
- Handle null returns gracefully with default values
- Check expiration before using retrieved data
- Use parallel retrieval for related data
- Implement caching for frequently accessed data
- Validate data integrity after retrieval