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
2 changes: 1 addition & 1 deletion include/gcache/ghost_kv_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct GhostKvMeta {
* pair can be variable-length. By default support sampling (non-sampling
* version can be acquired by setting SampleShift=0)
*/
template <uint32_t SampleShift = 5, typename Hash = std::hash<std::string_view>,
template <uint32_t SampleShift = 5, typename Hash = gshash,
typename SizeType = uint32_t, typename HashType = uint32_t>
class SampledGhostKvCache {
SampledGhostCache<SampleShift, idhash, GhostKvMeta<SizeType>, SizeType,
Expand Down
8 changes: 8 additions & 0 deletions include/gcache/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,12 @@ struct murmurhash {
uint32_t operator()(uint32_t x) const noexcept { return murmurhash_u32(x); }
};

/* Hash for string_view */

struct gshash { // default string hash function for gcache
uint32_t operator()(const std::string_view x) const noexcept {
return crc32_u32(0x537, std::hash<std::string_view>{}(x));
}
};

} // namespace gcache