2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-04 08:35:21 +00:00

Use Storage::Cache::Database for file caching.

This commit is contained in:
John Preston
2018-08-27 14:35:58 +03:00
parent a58c082cfa
commit 2e7f4c2f21
30 changed files with 537 additions and 888 deletions

View File

@@ -126,6 +126,9 @@ void Uploader::uploadMedia(const FullMsgId &msgId, const SendMediaReady &media)
: Auth().data().document(media.document, media.photoThumbs.begin().value());
if (!media.data.isEmpty()) {
document->setData(media.data);
if (document->saveToCache()) {
Auth().data().cache().put(document->cacheKey(), media.data);
}
}
if (!media.file.isEmpty()) {
document->setLocation(FileLocation(media.file));
@@ -148,6 +151,11 @@ void Uploader::upload(
document->uploadingData = std::make_unique<Data::UploadState>(document->size);
if (!file->content.isEmpty()) {
document->setData(file->content);
if (document->saveToCache()) {
Auth().data().cache().put(
document->cacheKey(),
file->content);
}
}
if (!file->filepath.isEmpty()) {
document->setLocation(FileLocation(file->filepath));