2222#include < cache/DefaultCacheImpl.h>
2323#include < olp/core/utils/Dir.h>
2424
25- using namespace olp ::cache;
25+ namespace cache = olp::cache;
2626
2727namespace {
28- class DefaultCacheImplHelper : public DefaultCacheImpl {
28+ class DefaultCacheImplHelper : public cache :: DefaultCacheImpl {
2929 public:
30- DefaultCacheImplHelper (const CacheSettings& settings)
31- : DefaultCacheImpl(settings){};
30+ explicit DefaultCacheImplHelper (const cache:: CacheSettings& settings)
31+ : DefaultCacheImpl(settings) {}
3232
3333 bool HasLruCache () const { return GetMutableCacheLru ().get () != nullptr ; }
3434
@@ -114,7 +114,7 @@ TEST(DefaultCacheImplTest, LruCache) {
114114
115115 olp::cache::CacheSettings settings;
116116 settings.disk_path_mutable = cache_path;
117- settings.eviction_policy = EvictionPolicy::kLeastRecentlyUsed ;
117+ settings.eviction_policy = cache:: EvictionPolicy::kLeastRecentlyUsed ;
118118 DefaultCacheImplHelper cache (settings);
119119 cache.Open ();
120120
@@ -170,7 +170,7 @@ TEST(DefaultCacheImplTest, LruCache) {
170170
171171 olp::cache::CacheSettings settings;
172172 settings.disk_path_mutable = cache_path;
173- settings.eviction_policy = EvictionPolicy::kNone ;
173+ settings.eviction_policy = cache:: EvictionPolicy::kNone ;
174174 DefaultCacheImplHelper cache (settings);
175175 cache.Open ();
176176
@@ -340,20 +340,18 @@ TEST(DefaultCacheImplTest, MutableCacheSize) {
340340 {
341341 SCOPED_TRACE (" Put decode" );
342342
343- settings.eviction_policy = EvictionPolicy::kNone ;
343+ settings.eviction_policy = cache:: EvictionPolicy::kNone ;
344344 DefaultCacheImplHelper cache (settings);
345345 cache.Open ();
346346 cache.Clear ();
347347
348- cache.Put (
349- key1, data_string, [=]() { return data_string; },
350- (std::numeric_limits<time_t >::max)());
348+ cache.Put (key1, data_string, [=]() { return data_string; },
349+ (std::numeric_limits<time_t >::max)());
351350 auto data_size = key1.size () + data_string.size ();
352351
353352 EXPECT_EQ (data_size, cache.Size ());
354353
355- cache.Put (
356- key2, data_string, [=]() { return data_string; }, expiry);
354+ cache.Put (key2, data_string, [=]() { return data_string; }, expiry);
357355 data_size +=
358356 key2.size () + data_string.size () + cache.CalculateExpirySize (key2);
359357
@@ -363,7 +361,7 @@ TEST(DefaultCacheImplTest, MutableCacheSize) {
363361 {
364362 SCOPED_TRACE (" Put binary" );
365363
366- settings.eviction_policy = EvictionPolicy::kNone ;
364+ settings.eviction_policy = cache:: EvictionPolicy::kNone ;
367365 DefaultCacheImplHelper cache (settings);
368366 cache.Open ();
369367 cache.Clear ();
@@ -388,9 +386,8 @@ TEST(DefaultCacheImplTest, MutableCacheSize) {
388386 cache.Clear ();
389387
390388 cache.Put (key1, data_ptr, (std::numeric_limits<time_t >::max)());
391- cache.Put (
392- key2, data_string, [=]() { return data_string; },
393- (std::numeric_limits<time_t >::max)());
389+ cache.Put (key2, data_string, [=]() { return data_string; },
390+ (std::numeric_limits<time_t >::max)());
394391
395392 cache.Remove (key1);
396393 cache.Remove (key2);
@@ -407,8 +404,7 @@ TEST(DefaultCacheImplTest, MutableCacheSize) {
407404 cache.Clear ();
408405
409406 cache.Put (key1, data_ptr, expiry);
410- cache.Put (
411- key2, data_string, [=]() { return data_string; }, expiry);
407+ cache.Put (key2, data_string, [=]() { return data_string; }, expiry);
412408
413409 cache.Remove (key1);
414410 cache.Remove (key2);
@@ -426,8 +422,7 @@ TEST(DefaultCacheImplTest, MutableCacheSize) {
426422
427423 cache.Put (key1, data_ptr, (std::numeric_limits<time_t >::max)());
428424 cache.Put (key2, data_ptr, expiry);
429- cache.Put (
430- key3, data_string, [=]() { return data_string; }, expiry);
425+ cache.Put (key3, data_string, [=]() { return data_string; }, expiry);
431426 const auto data_size =
432427 key3.size () + data_string.size () + cache.CalculateExpirySize (key3);
433428
@@ -445,8 +440,7 @@ TEST(DefaultCacheImplTest, MutableCacheSize) {
445440 cache.Clear ();
446441
447442 cache.Put (key1, data_ptr, -1 );
448- cache.Put (
449- key2, data_string, [=]() { return data_string; }, -1 );
443+ cache.Put (key2, data_string, [=]() { return data_string; }, -1 );
450444
451445 cache.Get (key1);
452446 cache.Get (key2, [](const std::string& value) { return value; });
@@ -459,15 +453,14 @@ TEST(DefaultCacheImplTest, MutableCacheSize) {
459453 const std::string data_string{" this is key's data" };
460454 const std::string key{" somekey" };
461455
462- settings.eviction_policy = EvictionPolicy::kNone ;
456+ settings.eviction_policy = cache:: EvictionPolicy::kNone ;
463457 DefaultCacheImplHelper cache (settings);
464458
465459 cache.Open ();
466460 cache.Clear ();
467461
468- cache.Put (
469- key, data_string, [=]() { return data_string; },
470- (std::numeric_limits<time_t >::max)());
462+ cache.Put (key, data_string, [=]() { return data_string; },
463+ (std::numeric_limits<time_t >::max)());
471464 const auto data_size = key.size () + data_string.size ();
472465 cache.Close ();
473466 EXPECT_EQ (0u , cache.Size ());
@@ -487,7 +480,7 @@ TEST(DefaultCacheImplTest, MutableCacheSize) {
487480 std::vector<unsigned char > binary_data (data_size);
488481 olp::cache::CacheSettings settings;
489482 settings.disk_path_mutable = cache_path;
490- settings.eviction_policy = EvictionPolicy::kNone ;
483+ settings.eviction_policy = cache:: EvictionPolicy::kNone ;
491484 settings.max_disk_storage = 2u * 1024u * 1024u ;
492485 DefaultCacheImplHelper cache (settings);
493486
@@ -543,7 +536,7 @@ TEST(DefaultCacheImplTest, LruCacheEviction) {
543536 std::vector<unsigned char > binary_data (data_size);
544537 olp::cache::CacheSettings settings;
545538 settings.disk_path_mutable = cache_path;
546- settings.eviction_policy = EvictionPolicy::kNone ;
539+ settings.eviction_policy = cache:: EvictionPolicy::kNone ;
547540 settings.max_disk_storage = 2u * 1024u * 1024u ;
548541 DefaultCacheImplHelper cache (settings);
549542
@@ -590,7 +583,7 @@ TEST(DefaultCacheImplTest, LruCacheEviction) {
590583 std::vector<unsigned char > binary_data (data_size);
591584 olp::cache::CacheSettings settings;
592585 settings.disk_path_mutable = cache_path;
593- settings.eviction_policy = EvictionPolicy::kLeastRecentlyUsed ;
586+ settings.eviction_policy = cache:: EvictionPolicy::kLeastRecentlyUsed ;
594587 settings.max_disk_storage = 2u * 1024u * 1024u ;
595588 DefaultCacheImplHelper cache (settings);
596589
0 commit comments