put method
存入缓存
Implementation
Future<void> put(String key, V value) async {
switch (mode) {
case CacheMode.memory:
_memoryCache?.put(key, value);
break;
case CacheMode.persistent:
await _persistentCache?.put(key, value);
break;
case CacheMode.hybrid:
// 同时写入内存和磁盘
_memoryCache?.put(key, value);
await _persistentCache?.put(key, value);
break;
}
}