Cog/Utils/RedundantPlaylistDataStore.h
Christopher Snowhill da4630f4c5 Add a metadata loader cache
Promote the Plugin Controller source file to Objective-C++, and add a
simple data cache that holds on to requests for up to 5 seconds after
their last access, for preventing spammed requests from hitting files
over and over. This is apparently really relevant to the CUESheet reader
and its embedded CUESheet handling, as that tends to reread the same
file over and over as it populates the playlist with tracks. The nested
reader can also lead to repeated reading even on files without CUESheets
embedded.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-26 23:24:32 -08:00

28 lines
694 B
Objective-C

//
// RedundantPlaylistDataStore.h
// Cog
//
// Created by Christopher Snowhill on 2/16/22.
//
// This is designed primarily for the PlaylistEntry info loader, to prevent
// memory overrun due to redundant blobs of data being duplicated repeatedly
// until the list is fully loaded. This instance will be discarded after the
// info is loaded, freeing up hopefully way less memory afterward than now.
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface RedundantPlaylistDataStore : NSObject {
NSMutableArray *stringStore;
NSMutableDictionary *artStore;
}
- (id)init;
- (NSDictionary *)coalesceEntryInfo:(NSDictionary *)pe;
- (void)reset;
@end
NS_ASSUME_NONNULL_END