當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python Streamlit st.experimental_memo.clear用法及代碼示例

清除所有內存和磁盤備忘錄緩存。

函數簽名

st.experimental_memo.clear()

示例

在下麵的示例中,按下 "Clear All" 按鈕將清除所有用 @st.experimental_memo 修飾的函數的 memory 值。

import streamlit as st

@st.experimental_memo
def square(x):
    return x**2

@st.experimental_memo
def cube(x):
    return x**3

if st.button("Clear All"):
    # Clear values from *all* memoized functions:
    # i.e. clear values from both square and cube
    st.experimental_memo.clear()

相關用法


注:本文由純淨天空篩選整理自streamlit.io大神的英文原創作品 st.experimental_memo.clear。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。