mirror of
https://github.com/trapexit/mergerfs.git
synced 2024-11-25 09:41:43 +08:00
policy_cache.hpp
This commit is contained in:
parent
39778ab529
commit
c79fcaec9d
|
@ -49,6 +49,29 @@ public:
|
|||
}
|
||||
|
||||
public:
|
||||
const
|
||||
char*
|
||||
insert(const char *key_,
|
||||
std::string const &val_)
|
||||
{
|
||||
uint64_t hash;
|
||||
const char *ptr;
|
||||
STRPOOL_U64 token;
|
||||
|
||||
hash = wyhash(key_.c_str(),key_.size(),0xdeadbeef,_wyp);
|
||||
token = strpool_inject(&_strpool,val_.c_str(),val_.size());
|
||||
ptr = strpool_cstr(&_strpool,token);
|
||||
_cache.insert_or_assign(hash,ptr);
|
||||
|
||||
fmt::print("insert {}={} token={} ptr={}\n",
|
||||
key_,
|
||||
val_,
|
||||
token,
|
||||
ptr);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
const
|
||||
char*
|
||||
insert(std::string const &key_,
|
||||
|
|
Loading…
Reference in New Issue
Block a user