diff --git a/imperative/src/impl/persistent_cache.cpp b/imperative/src/impl/persistent_cache.cpp index 63b4ab4ca0d79509d65ea302c48cdea5f7498185..30e965fa4cd34f2b4b031e3173f14df1e29e5c81 100644 --- a/imperative/src/impl/persistent_cache.cpp +++ b/imperative/src/impl/persistent_cache.cpp @@ -93,19 +93,20 @@ public: } std::optional clear() override { - size_t cursor = 0, nr_deleted = 0; - std::string pattern = m_prefix + "@*"; + long long cursor = 0; + size_t nr_deleted = 0; + std::string pattern = m_prefix + "*"; do { auto reply = m_client.scan(cursor, pattern).share(); sync(); auto keys = reply.get().as_array(); std::vector string_keys; - for (auto&& key : keys) { + for (auto&& key : keys[1].as_array()) { string_keys.push_back(key.as_string()); } m_client.del(string_keys); nr_deleted += string_keys.size(); - cursor = reply.get().as_array()[0].as_integer(); + cursor = std::stoll(keys[0].as_string()); } while (cursor != 0); return nr_deleted; }