| 672 | } |
| 673 | |
| 674 | int CFrmExtensionStore::SaveToCache(const QString &key, const QJsonObject &data) |
| 675 | { |
| 676 | QString cachePath = GetCachePath() + "/" + key + ".json"; |
| 677 | |
| 678 | QJsonDocument doc(data); |
| 679 | QFile file(cachePath); |
| 680 | |
| 681 | if(file.open(QIODevice::WriteOnly)) { |
| 682 | file.write(doc.toJson()); |
| 683 | file.close(); |
| 684 | qDebug(log) << "Cached:" << key; |
| 685 | return 0; |
| 686 | } |
| 687 | |
| 688 | return -1; |
| 689 | } |
| 690 | |
| 691 | QJsonObject CFrmExtensionStore::LoadFromCache(const QString &key) const |
| 692 | { |