plivesey / RocketData

A caching and consistency solution for immutable models.
https://plivesey.github.io/RocketData
Apache License 2.0
648 stars 50 forks source link

Is there a way to wipe all models from both cache and memory? #51

Closed akaralar closed 7 years ago

akaralar commented 7 years ago

Hey,

When a user logs out, I want to wipe everything so that cached items don't leak into the next session. I went through the docs but couldn't make out if this was supported?

plivesey commented 7 years ago

Since the cache is owned by you, you should be able to just call wipe on the cache directly.

akaralar commented 7 years ago

Will the managed models in memory be wiped in that case as well? It might be that I'm being too much asking for these reactive features but just wanted to make sure :)

plivesey commented 7 years ago

Oh yes, interesting...no, they won't be wiped. The way that we do this is we clean the view controllers. Since the view controllers hold onto the data providers, everything disappears automatically.

plivesey commented 7 years ago

The consistency manager has a method clearListenersAndCancelAllTasks which erases all the managed models (but the data providers still have a reference to the models - just they are now unmanaged).

plivesey commented 7 years ago

However, this doesn't wipe the collections in the SharedCollectionManager.

akaralar commented 7 years ago

Alright, the app I'm working on is browsable when there are no users as well, but I think this is too much of an edge case to think about. Thanks for the info!