-
Notifications
You must be signed in to change notification settings - Fork 10
Description
🚀 Feature Description
Implement a temporary cache, meaning a cache which lives in the process memory (on the heap).
The cache will be lost everytime the app is closed (or removed by task manger), hence not storing any songs or data on the device itself.
💭 Problem/Motivation
Since the last played song is already buffered in the heap memory of the process (you can turn wifi off at it will still play), it could be helpful to expand this concept by creating a temporary cache, storing the played songs during the session (up to a max number or max size).
During a session is common to listen back to a song already played, therefore it would reduce data tranfering overhead, buffering overhead and potentially streaming problems.
💡 Proposed Solution
Perhaps a hashmap could be used as a cache, making retrieval and insertion time
It would also need an update on settings side, due to the creation of sliders / box where one can choose either the size in song numbers or memory size of the cache and a togglable button to activate or deactivate this feature.
🔄 Alternatives Considered
One could also use a balanced tree (e.g. avl or red-black tree), or other indexing specific DT, although might be an overkill.
📋 Additional Context
Since the cache is implemented on the heap, once the app is closed and the memory is deallocated, all songs and music datas are lost.
This shouldn't go against the ToS of YouTube/ YT Music, because there is no download of songs (which is a premium feature) nor the songs get stored on the disk memory of the device.