Open
Description
I am filing this issue as a general feature request. I have already implemented this elsewhere, but would need some help from iOS to make it cross platform. In a number of my projects I have implemented a class with this signature:
interface FirebaseStorageFetcher {
/**
* Get a file from FirebaseStorage, or return the cached contents if the file has been downloaded
* since the specified "max age"
*/
public Task<byte[]> get(String path, long maxAge, TimeUnit timeUnit);
}
The class does a number of useful things:
- Cache files locally, keeping track of last downloaded time
- When asked for a file, it firsts issues a metadata request to see if the file has been recently updated
One use case for this is storing a frequently accessed configuration file in Firebase Storage. This class encapsulates all of the logic needed to download it on a regular basis while treating it like a local file.