Skip to content

Commit b429625

Browse files
committed
Add cautions for cache_set
1 parent 2bde2d2 commit b429625

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

crates/pink/pink-extension/src/chain_extension.rs

+14
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,20 @@ pub trait PinkExt {
257257
///
258258
/// * `Result<(), StorageQuotaExceeded>` - `Ok(())` or `Err(StorageQuotaExceeded)` if the storage quota is exceeded.
259259
///
260+
/// <p style="background:rgba(255,181,77,0.16);padding:0.75em;">
261+
/// <strong>Warning:</strong>
262+
/// The cache is not guaranteed to be persistent. It may be cleared at any time due
263+
/// to various reasons:
264+
///
265+
/// - The cached item is expired.
266+
/// - The entire cache in pRuntime is full and a new value needs to be stored (either from the contract itself or
267+
/// other contracts).
268+
/// - The worker is restarted.
269+
/// </p>
270+
///
271+
/// In order to use cache, the contract need to be staked via the phala on-chain API `PhatTokenomic::adjust_stake`.
272+
/// All contracts will share the 20MB cache storage by the ratio of stake.
273+
///
260274
/// # Example
261275
///
262276
/// ```

0 commit comments

Comments
 (0)