-
Notifications
You must be signed in to change notification settings - Fork 449
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
Caching Library Discussions #8
Comments
Thanks, @matzuk!
Please, let me know your thoughts! |
@weeeBox my thoughts =)
Hm. I used the word "Service" because I assume EvictionPolicy can be some kind of separate technical business logic that is executing somewhere (maybe in Android Service =)). It's not a typical domain like UseCase or Interactor does.
I lean towards this idea because we have a deal with Heap Memory additionally. We can't save all things in Heap even during one session because Heap has some memory limits and we can catch OutOfMemory. All of this leads to working with HeapMemory through a separate Entity/Client to control it. So, it means that we can't put everything to DB, that's why it makes sense to separate all these things (FS, Heap, DB) in the beginning. |
Here are my thoughts on Android services:
I advocated for a simpler high-level diagram for the following reasons:
p.s. this is just my opinion and it's not necessarily correct. Please, let me know your thoughts! |
A side note: I have submitted the article draft to ProAndroidDev. It's not perfect but it's good enough. We can have more discussions and refine the design later on. |
Yep, sure, I am against using Android Services too. My point was about only using the word "Service" =) |
@weeeBox : how do you restore the last Memory-Cache for the next time of using CachingLibrary? |
@weeeBox : can we use simply a |
Most likely, you don't want to do anything special since accessing the cached elements would put them into the memory. If the user wants to "warm-up" the cache - they can access certain items shortly after the initialization.
A self-balancing tree allows in-order traversal using custom iterators. So for example, you can get the largest element, delete it, and repeat until the cache size is adjusted. A regular map won't work since you won't have a |
Discussions about Caching Library.
First of all, thank you for your job! It's a great base for mobile system design interviews.
But, I have some suggestions/comments. I hope these things will help you. Let's go!
When I tried to design this library (before watching your solution sure) I've thought about the next picture:
Let me describe the main points:
CacheRepository
hides the implementation of a cache.The text was updated successfully, but these errors were encountered: