// Always delete the DB object before calling this method!
virtual void DisownData(){
// default implementation is noop
- };
+ }
// Apply callback to all entries in the cache
// If thread_safe is true, it will also lock the accesses. Otherwise, it will
virtual size_t GetUniqueId(char* /*id*/, size_t /*max_size*/) const {
return 0; // Default implementation to prevent issues with backwards
// compatibility.
- };
+ }
enum AccessPattern { NORMAL, RANDOM, SEQUENTIAL, WILLNEED, DONTNEED };
}
size_t GetUniqueId(char* id, size_t max_size) const override {
return target_->GetUniqueId(id, max_size);
- };
+ }
void Hint(AccessPattern pattern) override { target_->Hint(pattern); }
bool use_direct_io() const override { return target_->use_direct_io(); }
size_t GetRequiredBufferAlignment() const override {
}
}
- void remove_prefix(size_t /*n*/) {
- assert(0); // Not implemented
+ void remove_prefix(size_t n) {
+ assert(n <= size());
+ if (pinned_) {
+ data_ += n;
+ size_ -= n;
+ } else {
+ buf_->erase(0, n);
+ PinSelf();
+ }
}
void Reset() {
virtual bool getTickerMap(std::map<std::string, uint64_t>*) const {
// Do nothing by default
return false;
- };
+ }
// Override this function to disable particular histogram collection
virtual bool HistEnabledForType(uint32_t type) const {