|
pianod2
multisource multiuser scriptable networked music player
|
A cache/pool that retains all music thingies, mixed, and allows them to be retrieved from a single place by ID. More...
#include <musiccache.h>


Public Member Functions | |
| ThingiePool () | |
| Initialize a thingie storage cache/pool. More... | |
| ThingiePool (const ThingiePoolParameters ¶ms) | |
| Initialize a thingie storage cache/pool. More... | |
| void | setParameters (const ThingiePoolParameters ¶ms) |
| Update the cache's retention parameters. More... | |
| void | add (MusicThingie *thing, bool update=false) |
| Add (or update) an item to the cache. More... | |
| void | add (const SongList &songs) |
| Add several things to the cache. More... | |
| void | add (const ThingieList &things) |
| Add several things to the cache. More... | |
| void | update (MusicThingie *thing) |
| void | update (const SongList &songs) |
| Add or update several things to the cache. More... | |
| void | update (const ThingieList &things) |
| Add or update several things to the cache. More... | |
| void | erase (MusicThingie *thing) |
| Remove a thing from the cache. More... | |
| MusicThingie * | get (const std::string &id) |
| Get an item from the cache. More... | |
| ThingieList | get (const Filter &filter) |
| Get matching items from the cache. More... | |
| void | periodic (void) |
| Periodically pare down the cache. More... | |
Private Types | |
| using | map_type = std::unordered_map< std::string, ThingieCache > |
Private Member Functions | |
| void | purge (void) |
| Pare down the cache. More... | |
Private Attributes | |
| ThingiePoolParameters | settings |
| time_t | next_purge { time (nullptr) + 4000 } |
| time_t | oldest_entry { time (nullptr) } |
A cache/pool that retains all music thingies, mixed, and allows them to be retrieved from a single place by ID.
|
private |
| ThingiePool::ThingiePool | ( | ) |
Initialize a thingie storage cache/pool.
| ThingiePool::ThingiePool | ( | const ThingiePoolParameters & | params | ) |
Initialize a thingie storage cache/pool.
| params | Parameters describing the cache's retention and purge behavior. |
| void ThingiePool::add | ( | const SongList & | list | ) |
Add several things to the cache.
For any that already exist, keep the prior cached entry unless expiredp.
| list | A list of things to add to the cache. |

| void ThingiePool::add | ( | const ThingieList & | list | ) |
Add several things to the cache.
For any that already exist, keep the prior cached entry unless expired.
| list | A list of things to add to the cache. |

| void ThingiePool::add | ( | MusicThingie * | thing, |
| bool | replace = false |
||
| ) |
Add (or update) an item to the cache.
If duplicate, will replace the item with the one from the cache, or vice-versa, depending on preferNew setting at cache instantiation.
| thing | The item to put in the cache. |
| replace | If true, existing cache items will be replaced. If false, existing cached items are retained unless expired. |


| void ThingiePool::erase | ( | MusicThingie * | thing | ) |
Remove a thing from the cache.


| ThingieList ThingiePool::get | ( | const Filter & | filter | ) |
Get matching items from the cache.
| filter | A filter to select things to get. |

| MusicThingie * ThingiePool::get | ( | const std::string & | id | ) |
Get an item from the cache.
| id | The identifier of the thing to get. |

|
inline |
Periodically pare down the cache.


|
private |
Pare down the cache.


| void ThingiePool::setParameters | ( | const ThingiePoolParameters & | params | ) |
Update the cache's retention parameters.


| void ThingiePool::update | ( | const SongList & | list | ) |
Add or update several things to the cache.
| list | A list of things to put in the cache. |

| void ThingiePool::update | ( | const ThingieList & | list | ) |
Add or update several things to the cache.
| list | A list of things to put in the cache. |

|
inline |


|
private |
|
private |
|
private |