Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(server): add lru data structure #831

Merged
merged 1 commit into from
Feb 21, 2023
Merged

feat(server): add lru data structure #831

merged 1 commit into from
Feb 21, 2023

Conversation

romange
Copy link
Collaborator

@romange romange commented Feb 20, 2023

Part of the heavy keeper algo, required for #257.
Also see #446 for the initial (abandoned) PR.

@romange romange requested a review from ashotland February 20, 2023 19:33
uint32_t prev;
uint32_t next;

uint64_t value;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you intend to use it only for counting?
If so maybe rename to SimpleLruCounter and uint64_t count, it will also make it clearer why the value is not templated

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


SimpleLRU::SimpleLRU(size_t capacity) : head_(0) {
CHECK_GT(capacity, 1u);
node_arr_.resize(capacity);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cap at max uint32 ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignored :)

src/core/simple_lru.cc Outdated Show resolved Hide resolved
Part of the heavy keeper algo, required for #257.
Also see #446 for the initial (abandoned) PR.

Signed-off-by: Roman Gershman <[email protected]>
@romange romange merged commit e52b0f4 into main Feb 21, 2023
@romange romange deleted the AddLru branch February 21, 2023 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants