addCacheData method
Implementation
Future<bool> addCacheData(APICacheDBModel model) async {
await APICacheDBHelper.init();
bool isSaved = false;
model.syncTime = new DateTime.now().millisecondsSinceEpoch;
int res;
if (!await this.isAPICacheKeyExist(model.key)) {
res = await APICacheDBHelper.insert(APICacheDBModel.table, model);
} else {
res = await APICacheDBHelper.customUpdate(
APICacheDBModel.table,
model,
columnName: "key",
columnValue: model.key,
);
}
isSaved = res > 0 ? true : false;
return isSaved;
}