中级
实现设备状态Cache-Aside
未完成
中级参考
代码结构已给出,请填写 ____ 处
def solve():
from pyodide.http import open_url
from io import StringIO
import pandas as pd
cache_csv = open_url(____).read()
cache = pd.read_csv(StringIO(____))
reads = cache[cache['____']=='____']
total_reads = len(____)
hits = int(reads['____'].sum())
hit_rate = hits/total_reads if total_reads > ____ else ____
print("____" + str(____))
print("____" + str(____) + "____" + str(round(____)) + "____")
print("____" + str(____))
print(____)
for _, row in reads.head(____).iterrows():
action = "____" if row['____'] else "____"
print(____)
示例
输入
solve()
期望输出
Cache reads: 16 Hits: 12 (75.0%) Misses: 4 Cache-Aside pattern: device:DEV001:latest: HIT -> return cached device:DEV010:latest: HIT -> return cached device:DEV010:latest: HIT -> return cached device:DEV007:latest: MISS -> query DB -> write cache device:DEV001:latest: HIT -> return cached
👑
升级 VIP
解锁全部题目,畅通无阻地学习
- ✓ 解锁全部训练包所有题目
- ✓ 查看完整参考代码和提示
- ✓ 浏览器内直接运行 Python 代码
- ✓ 自动批改 + 进度追踪
30天
¥18
1年
¥99
2年
¥158
3年
¥199