| 34 | namespace cache |
| 35 | { |
| 36 | struct Key { |
| 37 | ~Key() |
| 38 | { |
| 39 | assert(key_ != nullptr); |
| 40 | TSCacheKeyDestroy(key_); |
| 41 | } |
| 42 | |
| 43 | Key() : key_(TSCacheKeyCreate()) { assert(key_ != nullptr); } |
| 44 | Key(const Key &) = delete; |
| 45 | Key &operator=(const Key &) = delete; |
| 46 | |
| 47 | explicit Key(const std::string &s) : key_(TSCacheKeyCreate()) |
| 48 | { |
| 49 | assert(key_ != nullptr); |
| 50 | CHECK(TSCacheKeyDigestSet(key_, s.c_str(), s.size())); |
| 51 | } |
| 52 | |
| 53 | TSCacheKey |
| 54 | key() const |
| 55 | { |
| 56 | return key_; |
| 57 | } |
| 58 | |
| 59 | TSCacheKey key_; |
| 60 | }; |
| 61 | |
| 62 | template <class T> struct Read { |
| 63 | using Self = Read<T>; |