From 36191c4168a543f7da14a41ec0ff73f52683b4d5 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Sat, 27 Jan 2024 11:18:07 +0200 Subject: [PATCH] Make LruCache::exists const --- include/dracon/utils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/dracon/utils.h b/include/dracon/utils.h index a16ed9c..56ccba3 100644 --- a/include/dracon/utils.h +++ b/include/dracon/utils.h @@ -62,7 +62,7 @@ class SpinLock m_lock.clear(std::memory_order_release); } - inline bool tryLock() + inline bool tryLock() noexcept { return !m_lock.test_and_set(std::memory_order_acquire); } @@ -193,7 +193,7 @@ class LruCache return it->second->second; } - inline bool exists(const K &key) + inline bool exists(const K &key) const { return m_cacheHash.find(key) != m_cacheHash.end(); }