Baseflow / flutter_cache_manager

Generic cache manager for flutter
https://baseflow.com
MIT License
756 stars 442 forks source link

feat: add hive #121

Open Gorniv opened 5 years ago

Gorniv commented 5 years ago

Use hive(https://github.com/hivedb/hive) instead SQLite.

petermichaux commented 4 years ago

@Gorniv Why use hive instead of SQLite?

Nisthar commented 4 years ago

@petermichaux because its much faster than sqlite.

Gorniv commented 4 years ago

cache manager uses SQLite only like key-value storage, but hive faster! And I have crashed at the android device with SQLite error.

Nisthar commented 4 years ago

also i think hive have a simple api than sqlite. so it would be easy to implement.

ahmedkassem commented 4 years ago

same problem here, sqlite causes this problem Warning database has been locked for 0:00:10.000000. Make sure you always use the transaction object for database operations during a transaction

Gorniv commented 4 years ago

hivedb support web!

britannio commented 4 years ago

This package is used to store files, something that cannot be done on web as dart:io isn't available so web support isn't a concern.

Maybe migrating to moor is viable? A dev version using moor_ffi would be awesome

Gorniv commented 4 years ago

hivedb work in web. Read docs of hivedb

britannio commented 4 years ago

hivedb work in web. Read docs of hivedb

I know, read my message again.

Gorniv commented 4 years ago

sorry, I think you write about hive)

venkatd commented 4 years ago

If someone is interested in adding support, they would need to implement the CacheInfoRepository interface: https://github.com/Baseflow/flutter_cache_manager/blob/ed5a205bcb5e816d05113c0360fea02aadc7e2be/flutter_cache_manager/lib/src/storage/cache_info_repository.dart

joe-getcouragenow commented 4 years ago

This one works well for me:

https://github.com/vishna/flutter_cache_manager_hive

a0v0 commented 1 year ago

any update?

yangsfang commented 1 year ago

I don't think this is a Hive vs sqflite debate. flutter_cache_manager is a library, and it should have flexibility depending on what the developer needs to use in the rest of the project. The worst case is to dictate sqflite or hive when the developer is using the other one, and that means pulling in two dependencies, increases compile time, increases app size, increases app loading time, increases memory jank, increases garbage collection interruption, giving a worse user experience.

We don't want that. We want to have the flexibility, which is why interface pattern is so cherished by developers. We do have the cache_info_repository.dart like an interface, maybe this file should be pulled into a separate Dart package on its own, and refactor flutter_cache_manager into a sqflite implementation. This allows someone to make the Hive implementation. Then we are all good to choose whichever dependency we like.

OnClickListener2048 commented 3 months ago

hivedb work in web. Read docs of hivedb

why not drift

OnClickListener2048 commented 3 months ago

This package is used to store files, something that cannot be done on web as dart:io isn't available so web support isn't a concern.

Maybe migrating to moor is viable? A dev version using moor_ffi would be awesome

why not drift