Skip to content

Commit

Permalink
Merge branch 'develop' into build/add-pub-platform-declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
martijn00 authored Jul 31, 2024
2 parents c8567c8 + 5345af5 commit 0d25eaf
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 7 deletions.
1 change: 0 additions & 1 deletion flutter_cache_manager/lib/src/cache_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'package:file/file.dart';
import 'package:flutter/foundation.dart' show visibleForTesting;
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:flutter_cache_manager/src/cache_store.dart';
import 'package:flutter_cache_manager/src/storage/cache_object.dart';
import 'package:flutter_cache_manager/src/web/web_helper.dart';
import 'package:uuid/uuid.dart';

Expand Down
5 changes: 4 additions & 1 deletion flutter_cache_manager/lib/src/cache_store.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'dart:async';

import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:flutter_cache_manager/src/storage/cache_object.dart';
import 'package:flutter_cache_manager/src/storage/file_system/file_system.dart';

///Flutter Cache Manager
Expand Down Expand Up @@ -188,6 +187,10 @@ class CacheStore {
}
}

bool memoryCacheContainsKey(String key) {
return _memCache.containsKey(key);
}

Future<void> dispose() async {
final provider = await _cacheInfoRepository;
await provider.close();
Expand Down
1 change: 0 additions & 1 deletion flutter_cache_manager/lib/src/web/web_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import 'package:clock/clock.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:flutter_cache_manager/src/cache_store.dart';
import 'package:flutter_cache_manager/src/storage/cache_object.dart';
import 'package:flutter_cache_manager/src/web/queue_item.dart';
import 'package:rxdart/rxdart.dart';
import 'package:uuid/uuid.dart';
Expand Down
1 change: 0 additions & 1 deletion flutter_cache_manager/test/cache_manager_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'package:clock/clock.dart';
import 'package:file/memory.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:flutter_cache_manager/src/cache_store.dart';
import 'package:flutter_cache_manager/src/storage/cache_object.dart';
import 'package:flutter_cache_manager/src/web/web_helper.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/mockito.dart';
Expand Down
17 changes: 17 additions & 0 deletions flutter_cache_manager/test/cache_store_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,23 @@ void main() {
await store.getFile(fileUrl);
expect(await store.getFileFromMemory(fileUrl), isNotNull);
});

test(
'Store.memoryCacheContainsKey should return true if the key is present in the memory cache',
() async {
var config = createTestConfig();
var store = CacheStore(config);

var cacheObject = CacheObject(
'baseflow.com/test.png',
relativePath: 'testimage.png',
validTill: clock.now().add(const Duration(days: 7)),
);
await store.putFile(cacheObject);

expect(store.memoryCacheContainsKey('baseflow.com/test.png'), true);
expect(store.memoryCacheContainsKey('unseen-file'), false);
});
});

group('Storing files in store', () {
Expand Down
1 change: 0 additions & 1 deletion flutter_cache_manager/test/helpers/json_repo_helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:clock/clock.dart';
import 'package:file/file.dart';
import 'package:file/memory.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:flutter_cache_manager/src/storage/cache_object.dart';

const String databaseName = 'test';
const String path =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:collection/collection.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:flutter_cache_manager/src/storage/cache_object.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/mockito.dart';

Expand Down
1 change: 0 additions & 1 deletion flutter_cache_manager/test/web_helper_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'dart:async';
import 'package:clock/clock.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:flutter_cache_manager/src/cache_store.dart';
import 'package:flutter_cache_manager/src/storage/cache_object.dart';
import 'package:flutter_cache_manager/src/web/web_helper.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/mockito.dart';
Expand Down

0 comments on commit 0d25eaf

Please sign in to comment.