You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (toRemove.contains(cacheObject.id)) return;
toRemove.add(cacheObject.id!);
if (_memCache.containsKey(cacheObject.key)) {
_memCache.remove(cacheObject.key);
}
if (_futureCache.containsKey(cacheObject.key)) {
await _futureCache.remove(cacheObject.key);
}
final file = io.File(cacheObject.relativePath);
if (file.existsSync()) {
try {
await file.delete();
// ignore: unused_catch_clause
} on PathNotFoundException catch (e) {
// File has already been deleted. Do nothing #184
}
}
cacheObject.relativePath is not real abs file path ,delete file can not work class CustomCacheManager { static const key = 'tsl'; static final fileSystem = ExternalStorageFileSystem(key); static CacheManager instance = CacheManager( Config(key, stalePeriod: const Duration(days: 30), maxNrOfCacheObjects: 999999999, fileSystem: fileSystem), ); }
`
class ExternalStorageFileSystem implements FileSystem {
final Future _fileDir;
final String _cacheKey;
cacheObject.relativePath is not real abs file path ,delete file can not work
class CustomCacheManager { static const key = 'tsl'; static final fileSystem = ExternalStorageFileSystem(key); static CacheManager instance = CacheManager( Config(key, stalePeriod: const Duration(days: 30), maxNrOfCacheObjects: 999999999, fileSystem: fileSystem), ); }
`
class ExternalStorageFileSystem implements FileSystem {
final Future _fileDir;
final String _cacheKey;
ExternalStorageFileSystem(this._cacheKey)
: _fileDir = createDirectory(_cacheKey);
static Future createDirectory(String key) async {
final baseDir = await getExternalStorageDirectory();
final path = p.join(baseDir!.path, key);
}
@OverRide
Future createFile(String name) async {
final directory = await _fileDir;
if (!(await directory.exists())) {
await createDirectory(_cacheKey);
}
return directory.childFile(name);
}
void emptyCache() async {
final directory = await _fileDir;
if (await directory.exists()) {
await directory.delete(recursive: true);
}
}
}
`
The text was updated successfully, but these errors were encountered: