@@ -90,6 +90,9 @@ class TaggedCache
9090 int
9191 getCacheSize () const ;
9292
93+ int
94+ getTrackSize () const ;
95+
9396 float
9497 getHitRate ();
9598
@@ -167,6 +170,9 @@ class TaggedCache
167170 bool
168171 retrieve (key_type const & key, T& data);
169172
173+ mutex_type&
174+ peekMutex ();
175+
170176 std::vector<key_type>
171177 getKeys () const ;
172178
@@ -187,14 +193,11 @@ class TaggedCache
187193
188194private:
189195 SharedPointerType
190- initialFetch (key_type const & key);
196+ initialFetch (key_type const & key, std::lock_guard<mutex_type> const & l );
191197
192198 void
193199 collect_metrics ();
194200
195- Mutex&
196- lockPartition (key_type const & key) const ;
197-
198201private:
199202 struct Stats
200203 {
@@ -297,8 +300,8 @@ class TaggedCache
297300 [[maybe_unused]] clock_type::time_point const & now,
298301 typename KeyValueCacheType::map_type& partition,
299302 SweptPointersVector& stuffToSweep,
300- std::atomic<int >& allRemoval ,
301- Mutex& partitionLock );
303+ std::atomic<int >& allRemovals ,
304+ std::lock_guard<std::recursive_mutex> const & );
302305
303306 [[nodiscard]] std::thread
304307 sweepHelper (
@@ -307,12 +310,14 @@ class TaggedCache
307310 typename KeyOnlyCacheType::map_type& partition,
308311 SweptPointersVector&,
309312 std::atomic<int >& allRemovals,
310- Mutex& partitionLock );
313+ std::lock_guard<std::recursive_mutex> const & );
311314
312315 beast::Journal m_journal;
313316 clock_type& m_clock;
314317 Stats m_stats;
315318
319+ mutex_type mutable m_mutex;
320+
316321 // Used for logging
317322 std::string m_name;
318323
@@ -323,11 +328,10 @@ class TaggedCache
323328 clock_type::duration const m_target_age;
324329
325330 // Number of items cached
326- std::atomic< int > m_cache_count;
331+ int m_cache_count;
327332 cache_type m_cache; // Hold strong reference to recent objects
328- std::atomic<std::uint64_t > m_hits;
329- std::atomic<std::uint64_t > m_misses;
330- mutable std::vector<mutex_type> partitionLocks_;
333+ std::uint64_t m_hits;
334+ std::uint64_t m_misses;
331335};
332336
333337} // namespace ripple
0 commit comments