lesnitsky / flutter_localstorage

📦 LocalStorage for Flutter
MIT License
298 stars 65 forks source link

Flushing of setItem #26

Closed abacaj closed 4 years ago

abacaj commented 5 years ago

Hi,

in attemptFlush should we be passing boolean true to flush call here: await _file.writeAsString(serialized); await _file.writeAsString(serialized, flush: true);

Not flushing can have negative side effect of trying to read (after a large write operation) before it is in file system.

abacaj commented 5 years ago

Also curious, what is the purpose of readTest in throughput measurement?

It is just reading from memory... it will be as fast as the platform allows it to be - which is unrelated to the library. The writeTest makes more sense since that does have some logic for encoding.

oakromulo commented 4 years ago

@abacaj the read test is there mostly for two reasons:

Also curious, what is the purpose of readTest in throughput measurement?

oakromulo commented 4 years ago

@abacaj just tackled it for proposed v2.0.1 on commit https://github.com/lesnitsky/flutter_localstorage/pull/29/commits/49614e98d74cf03732a1580ccbe05d244b3b7765

@lesnitsky: this one is pretty important, @abacaj is absolutely right

in attemptFlush should we be passing boolean true to flush call here: await _file.writeAsString(serialized); await _file.writeAsString(serialized, flush: true);

lesnitsky commented 4 years ago

closed by 876b8e6c8c0890cd96d20b35e7bec0ff51ccd8eb