111111

 1 public class FileService
 2 {
 3     private readonly ConcurrentDictionary<string, byte[]> _cache;
 4     
 5     public FileService()
 6     {
 7         _cache = new ConcurrentDictionary<string, byte[]>();
 8     }
 9     
10     public byte[] GetFileContent(string filePath)
11     {
12         return _cache.GetOrAdd(filePath, _ =>
13         {
14             return File.ReadAllBytes(filePath);
15         });
16     }
17 }

 

上一篇:111111


下一篇:111111