Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DI: Unable to create in memory cache to save data. #486

Closed
ksharma-xyz opened this issue Dec 25, 2024 · 1 comment · Fixed by #485
Closed

DI: Unable to create in memory cache to save data. #486

ksharma-xyz opened this issue Dec 25, 2024 · 1 comment · Fixed by #485
Assignees

Comments

@ksharma-xyz
Copy link
Owner

Problem

We should be able to store some data in a Singleton class and use it as long as the app process is alive. Currently this is a limitation because of the DI framework being used. See for more details: InsertKoinIO/koin#2078

When we create a singleton class in Koin, it is only scoped to the activity and not the entire app lifecycle. As soon as the configuration is changed, a new object for Singleton class is created (not truly singleton). If the same object is re-used across config changes, we could store and retrieve data from it.

Proposed Solution

  1. Use other multiplatform DI libraries such as kotlin-inject / KodeIn, but need to first try out if they have the same issue.
  2. Maybe it will be fixed in Koin. SingleOf does not generate truly singleton objects InsertKoinIO/koin#2078
  3. Store data in db and clear it when app is closed. - Core: Replace in-memory alerts cache with SQLite storage #485

Issue Screenshots

Alerts_Issue.mov
@ksharma-xyz
Copy link
Owner Author

Going with approach 3 - #485

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant