123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- import 'package:vitalapp/architecture/storage/text_storage.dart';
- import 'package:vitalapp/managers/interfaces/cachedRecord.dart';
- class CachedRecordManager implements ICachedRecordManager {
- @override
- Future<bool?> saveCachedRecord(
- String key,
- String patientCode,
- String type,
- String cached,
- ) async {
- TextStorage cachedRecord = TextStorage(
- fileName: key,
- directory: "patient/$patientCode/$type",
- );
- return cachedRecord.save(cached);
- }
- @override
- Future<String?> readCachedRecord(
- String key,
- String patientCode,
- String type,
- ) async {
- TextStorage cachedRecord = TextStorage(
- fileName: key,
- directory: "patient/$patientCode/$type",
- );
- String? value = await cachedRecord.read();
- return value;
- }
- @override
- Future<bool?> deleteCachedRecord(
- String key,
- String patientCode,
- String type,
- ) async {
- TextStorage cachedRecord = TextStorage(
- fileName: key,
- directory: "patient/$patientCode/$type",
- );
- return cachedRecord.delete();
- }
- @override
- Future<bool?> deleteDirectory(
- String patientCode,
- String type,
- ) async {
- TextStorage cachedRecord = TextStorage(
- fileName: '',
- directory: "patient/$patientCode/$type",
- );
- return cachedRecord.deleteDirectory();
- }
- }
|