Skip to content

first storage#1

Open
LevKats wants to merge 3 commits into
masterfrom
storage1
Open

first storage#1
LevKats wants to merge 3 commits into
masterfrom
storage1

Conversation

@LevKats
Copy link
Copy Markdown
Owner

@LevKats LevKats commented Mar 6, 2020

No description provided.

Comment thread src/storage/SimpleLRU.cpp Outdated
return false;
}

if (Set(key, value)) {}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

if (!Set ())

Comment thread src/storage/SimpleLRU.cpp Outdated
return false;
}

if (Delete(key)) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

постоянно перевыделяешь память

Comment thread src/storage/SimpleLRU.cpp Outdated
bool SimpleLRU::Get(const std::string &key, std::string &value) { return false; }
bool SimpleLRU::Get(const std::string &key, std::string &value) {
auto new_key = key;
auto iter = _lru_index.find(std::ref(new_key));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

элемент нужно переместить в начало списка на удаление

Comment thread src/storage/SimpleLRU.h Outdated
@@ -44,19 +54,30 @@ class SimpleLRU : public Afina::Storage {
using lru_node = struct lru_node {
std::string key;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

const std::string key;

Comment thread src/storage/SimpleLRU.h
* @param key to be associated with value
* @param value to be assigned for the key
*/
void _PutWithoutCheck(const std::string &key, const std::string &value);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

private

Comment thread src/storage/SimpleLRU.cpp
}

if (!Set(key, value)) {
_PutWithoutCheck(key, value);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

В release сборке не проверяет лимит памяти

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.

3 participants