79 std::shared_ptr<const std::vector<uint8_t>> bytes;
80 std::string mime_type;
85 std::size_t byte_size{0};
102 void stage(uint64_t content_hash, QImage image);
104 uint64_t content_hash, std::shared_ptr<
const std::vector<uint8_t>> bytes,
105 std::string mime_type = {});
109 std::shared_ptr<const DecodedAsset> acquire(uint64_t content_hash);
116 std::shared_ptr<const DecodedAsset> peek(uint64_t content_hash)
const;
120 void release(uint64_t content_hash);
127 std::size_t trim(std::size_t max_bytes_budget);
139 float utilization,
float high_watermark = 0.80f,
140 float target = 0.60f);
143 std::size_t size() const noexcept;
145 std::
size_t totalBytes() const noexcept;
147 std::
size_t coldCount() const noexcept;
154 using LruList =
std::list<uint64_t>;
158 std::shared_ptr<DecodedAsset> asset;
159 LruList::iterator lru_it;
163 void evictOne() noexcept;
165 mutable
std::mutex m_mutex;
166 ossia::hash_map<uint64_t, Slot> m_entries;
168 std::
size_t m_total_bytes{0};
169 std::size_t m_cold_bytes{0};