Skip to content

Commit

Permalink
chore: fix nit
Browse files Browse the repository at this point in the history
  • Loading branch information
NegatioN committed Sep 30, 2024
1 parent 38ec7aa commit 5afeca0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
11 changes: 11 additions & 0 deletions src/core/dense_set.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ DenseSet::IteratorBase::IteratorBase(const DenseSet* owner, bool is_end)
}
}

void DenseSet::IteratorBase::SetExpiryTime(uint32_t ttl_sec) {
if (!HasExpiry()) {
auto src = curr_entry_->GetObject();
void* new_obj = owner_->ObjectClone(src, false, true);
curr_entry_->SetObject(new_obj);
curr_entry_->SetTtl(true);
owner_->ObjDelete(src, false);
}
owner_->ObjUpdateExpireTime(curr_entry_->GetObject(), ttl_sec);
}

void DenseSet::IteratorBase::Advance() {
bool step_link = false;
DCHECK(curr_entry_);
Expand Down
11 changes: 1 addition & 10 deletions src/core/dense_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,7 @@ class DenseSet {
return curr_entry_->HasTtl() ? owner_->ObjExpireTime(curr_entry_->GetObject()) : UINT32_MAX;
}

void SetExpiryTime(uint32_t ttl_sec) {
if (!HasExpiry()) {
auto src = curr_entry_->GetObject();
void* new_obj = owner_->ObjectClone(src, false, true);
curr_entry_->SetObject(new_obj);
curr_entry_->SetTtl(true);
owner_->ObjDelete(src, false);
}
owner_->ObjUpdateExpireTime(curr_entry_->GetObject(), ttl_sec);
}
void SetExpiryTime(uint32_t ttl_sec);

bool HasExpiry() const {
return curr_entry_->HasTtl();
Expand Down

0 comments on commit 5afeca0

Please sign in to comment.