Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions olp-cpp-sdk-core/include/olp/core/cache/KeyValueCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,20 @@ class CORE_API KeyValueCache {
OLP_SDK_CORE_UNUSED(prefix);
return client::ApiError(client::ErrorCode::Unknown, "Not implemented");
}

/**
* @brief Lists the keys that match the given prefix.
*
* @param prefix The prefix that matches the keys.
*
* @return The collection of matched keys or an error. Empty collection if not
* keys match the prefix.
*/
virtual OperationOutcome<KeyListType> ListKeysWithPrefix(
const std::string& prefix) {
OLP_SDK_CORE_UNUSED(prefix);
return client::ApiError(client::ErrorCode::Unknown, "Not implemented");
}
};

} // namespace cache
Expand Down
10 changes: 10 additions & 0 deletions olp-cpp-sdk-core/tests/cache/DefaultCacheTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,16 @@ TEST(DefaultCacheTest, OpenTypeCache) {
}
}

TEST(DefaultCacheTest, ListKeysWithPrefixNotImplemented) {
olp::cache::DefaultCache cache;

const auto result = cache.ListKeysWithPrefix("prefix");

EXPECT_FALSE(result.IsSuccessful());
EXPECT_EQ(olp::client::ErrorCode::Unknown, result.GetError().GetErrorCode());
EXPECT_EQ("Not implemented", result.GetError().GetMessage());
}

struct TestParameters {
OptionalString disk_path_mutable = kTempDirMutable;
OptionalString disk_path_protected = olp::porting::none;
Expand Down
Loading