Design a CachedFile class that serves repeated ranged reads of a remote file while minimizing network calls.
Unlock detailed company stats for this questionUpgrade
You are given an interface StorageClient that allows downloading files from a remote storage system: getFileSize(uri) returns the size of the file, and fetch(uri, offset, length, buffer) fetches length bytes starting at offset into buffer. Design a class CachedFile that downloads a remote file from a given uri, with clients calling it with different start and end ranges. Optimize it to support repeated reads efficiently and minimize repeated network calls.
Community answers
No answers contributed by the community yet.
Related courses

Course

Course
Course
