File tree Expand file tree Collapse file tree 3 files changed +19
-1
lines changed
Example/Tests/Integration/API Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 11# 10.11.0
22- [ feature] Expose MultiDb API for public preview. (#10465 )
33- [ fixed] Fixed a compilation warning related to integer casting. (#11332 )
4+ - [ fixed] Allow initializing FIRLocalCacheSettings with unlimited size. (#11405 )
45
56# 10.9.0
67- [ feature] Add new cache config API to customize SDK cache settings.
Original file line number Diff line number Diff line change 2828#import " Firestore/Source/API/FIRLocalCacheSettings+Internal.h"
2929
3030#include " Firestore/core/src/api/query_snapshot.h"
31+ #include " Firestore/core/src/api/settings.h"
3132#include " Firestore/core/src/core/firestore_client.h"
3233#include " Firestore/core/src/model/database_id.h"
3334#include " Firestore/core/src/util/string_apple.h"
3435#include " Firestore/core/test/unit/testutil/app_testing.h"
3536
37+ using api::Settings;
3638using firebase::firestore::model::DatabaseId;
3739using firebase::firestore::testutil::AppForUnitTesting;
3840using firebase::firestore::util::MakeNSString;
@@ -1813,4 +1815,18 @@ - (void)testMinimumCacheSize {
18131815 NSException );
18141816}
18151817
1818+ - (void )testUnlimitedCacheSize {
1819+ FIRPersistentCacheSettings *cacheSettings =
1820+ [[FIRPersistentCacheSettings alloc ] initWithSizeBytes: @(Settings: :CacheSizeUnlimited)];
1821+ XCTAssertEqual (cacheSettings.internalSettings .size_bytes (), Settings::CacheSizeUnlimited);
1822+
1823+ self.db .settings .cacheSettings = cacheSettings;
1824+
1825+ FIRDocumentReference *doc = [self .db documentWithPath: @" rooms/eros" ];
1826+ NSDictionary <NSString *, id > *data = @{@" value" : @" foo" };
1827+ [self writeDocumentRef: doc data: data];
1828+ FIRDocumentSnapshot *result = [self readDocumentForRef: doc];
1829+ XCTAssertEqualObjects (result.data , data);
1830+ }
1831+
18161832@end
Original file line number Diff line number Diff line change @@ -73,7 +73,8 @@ - (instancetype)init {
7373
7474- (instancetype )initWithSizeBytes : (NSNumber *)size {
7575 self = [super init ];
76- if (size.longLongValue < Settings::MinimumCacheSizeBytes) {
76+ if (size.longLongValue != Settings::CacheSizeUnlimited &&
77+ size.longLongValue < Settings::MinimumCacheSizeBytes) {
7778 ThrowInvalidArgument (" Cache size must be set to at least %s bytes" ,
7879 Settings::MinimumCacheSizeBytes);
7980 }
You can’t perform that action at this time.
0 commit comments