/* Entry */
virtual bool key_exists(const DoutPrefixProvider* dpp, const std::string& key) = 0;
+ virtual std::vector<Entry> list_entries(const DoutPrefixProvider* dpp) = 0;
virtual size_t get_num_entries(const DoutPrefixProvider* dpp) = 0;
/* Partition */
return result;
}
+std::vector<Entry> RedisDriver::list_entries(const DoutPrefixProvider* dpp) {
+ std::vector<Entry> result;
+
+ if (!client.is_connected())
+ return {};
+
+// try {
+ size_t cursor = 0;
+ const std::string pattern = "*:cache";
+
+ /* client.scan(cursor, pattern, [](cpp_redis::reply &reply) {
+ dout(0) << "Sam" << dendl;
+ if (!reply.is_null()) {
+ //result = reply.as_array();
+ }
+ });
+ client.sync_commit(std::chrono::milliseconds(1000));
+*/
+/* if (result.empty()) {
+ return {};
+ }
+ } catch(std::exception &e) {
+ return {};
+ }
+*/
+ dout(0) << "Sam: " << client.is_connected() << dendl;
+ return result;
+}
+
size_t RedisDriver::get_num_entries(const DoutPrefixProvider* dpp) {
int result = -1;
/* Entry */
virtual bool key_exists(const DoutPrefixProvider* dpp, const std::string& key) override;
+ virtual std::vector<Entry> list_entries(const DoutPrefixProvider* dpp) override;
virtual size_t get_num_entries(const DoutPrefixProvider* dpp) override;
/* Partition */