mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
Disk: ReadDriver: Add unified cache
Previously, we had to copy an entire block out of the old cache every time we wanted to read even a single byte from it. This ended up being a fairly significant performance issue, in addition to the fact that the caching code was duplicated.
This commit is contained in:
@@ -24,13 +24,8 @@ public:
|
||||
|
||||
private:
|
||||
static constexpr const uint32_t MaxSize = Disk::SectorSize * 512;
|
||||
static constexpr const std::chrono::seconds CacheTime = std::chrono::seconds(1);
|
||||
static constexpr const uint8_t HeaderLength = 7;
|
||||
|
||||
std::array<uint8_t, MaxSize> cache;
|
||||
uint64_t cachePos = 0;
|
||||
std::chrono::time_point<std::chrono::steady_clock> cachedAt;
|
||||
|
||||
Access getPossibleAccess() const override { return Access::EntireCard; }
|
||||
|
||||
optional<uint64_t> readLogicalDiskAligned(Communication& com, device_eventhandler_t report,
|
||||
|
||||
Reference in New Issue
Block a user