Skip to content
This repository has been archived by the owner on Dec 7, 2019. It is now read-only.

Is there a way to only clear memory cache? #320

Open
saket opened this issue Mar 20, 2018 · 10 comments
Open

Is there a way to only clear memory cache? #320

saket opened this issue Mar 20, 2018 · 10 comments

Comments

@saket
Copy link
Contributor

saket commented Mar 20, 2018

If I'm not wrong, there is no way to clear only the memory cache. clearMemory() is deprecated so this looks like an intentional behavior. I was hoping to clear my memory cache when ComponentCallbacks2#onTrimMemory() gets called. Is there any way to do this?

@wdziemia
Copy link
Contributor

Currently no, but we are actively looking into a solution to allow this, whether automated via ComponentCallbacks2 or manual. We will keep you posted! 🙂

@saket
Copy link
Contributor Author

saket commented Mar 20, 2018

Cool, thanks!

@dbof10
Copy link

dbof10 commented Mar 29, 2018

I think clear memory is an important feature. I get data for UserA when log into UserB I get stale data from UserA even though I try to call clear but that doesn't work.

@dbof10
Copy link

dbof10 commented Mar 29, 2018

I think we should label as bug

@pavlospt
Copy link
Contributor

There is an open PR for this #322

@digitalbuddha
Copy link
Contributor

That pr is not related to clearing more. Clear memory was Deprecated because clear now clears only memory unless you have a Persister that implements Clearable. Pls use clear as though it is clear memory.

@saket
Copy link
Contributor Author

saket commented Mar 29, 2018

@digitalbuddha but what if I only want to clear memory and not disk even if I have a Clearable persister?

@digitalbuddha
Copy link
Contributor

Could you kindly give a use case for wanting to clear memory and not disk sometimes but wanting to clear memory and disk other times for same store.

@saket
Copy link
Contributor Author

saket commented Mar 29, 2018

The same thing I mentioned in my original post. If I receive a callback from the system that the phone is running low on memory (onTrimMemory()), I'd like to clear my memory cache.

@digitalbuddha
Copy link
Contributor

open to a pr if you'd like, I'm not crazy about it but will take the contribution if someone else wants to do the work :-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants