Better update in memory cache
This commit is contained in:
@@ -1286,6 +1286,8 @@ class MLDataDB with SqlDbBase implements IMLDataDB<int> {
|
||||
];
|
||||
}
|
||||
|
||||
/// WARNING: Better to use the similarly named [putFaceIdCachedForPersonOrCluster]
|
||||
/// method from face_thumbnail_cache instead!
|
||||
Future<void> putFaceIdCachedForPersonOrCluster(
|
||||
String personOrClusterId,
|
||||
String faceID,
|
||||
|
||||
@@ -443,10 +443,7 @@ class PersonService {
|
||||
data: person.data.copyWith(avatarFaceId: face.faceID),
|
||||
);
|
||||
await updatePerson(updatedPerson);
|
||||
await faceMLDataDB.putFaceIdCachedForPersonOrCluster(
|
||||
p.remoteID,
|
||||
face.faceID,
|
||||
);
|
||||
await putFaceIdCachedForPersonOrCluster(p.remoteID, face.faceID);
|
||||
return updatedPerson;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,17 @@ Future<String?> checkUsedFaceIDForPersonOrClusterId(
|
||||
return faceIDFromDB;
|
||||
}
|
||||
|
||||
Future<void> putFaceIdCachedForPersonOrCluster(
|
||||
String personOrClusterID,
|
||||
String faceID,
|
||||
) async {
|
||||
await MLDataDB.instance.putFaceIdCachedForPersonOrCluster(
|
||||
personOrClusterID,
|
||||
faceID,
|
||||
);
|
||||
_personOrClusterIdToCachedFaceID.put(personOrClusterID, faceID);
|
||||
}
|
||||
|
||||
Future<void> _putCachedCropForFaceID(
|
||||
String faceID,
|
||||
Uint8List data, [
|
||||
@@ -72,11 +83,7 @@ Future<void> _putCachedCropForFaceID(
|
||||
]) async {
|
||||
_faceCropCache.put(faceID, data);
|
||||
if (personOrClusterID != null) {
|
||||
await MLDataDB.instance.putFaceIdCachedForPersonOrCluster(
|
||||
personOrClusterID,
|
||||
faceID,
|
||||
);
|
||||
_personOrClusterIdToCachedFaceID.put(personOrClusterID, faceID);
|
||||
await putFaceIdCachedForPersonOrCluster(personOrClusterID, faceID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user