← 返回 openai 的题目列表KV Store Implementation
类型:online_judge
Implement a key-value (KV) store system with the following functionalities:
set(key, value): Sets a key-value pair with the given key and value.
get(key): Retrieves the value of the key-value pair with the given key.
shutdown(): Simulates shutting down the system.
restore(): Restores the system from a shutdown state.
Note: Consider how the system should handle scenarios where there is a size limit on data.
Example
Input
kv_store.set('x', 'y')
print(kv_store.get('x'))
Output
y