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: new ContempCache1.0 #84

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

chennuo712
Copy link

No description provided.

Copy link
Collaborator

@ActivePeter ActivePeter left a comment

Choose a reason for hiding this comment

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

看起来新算法没上来,这个commit取名不太合适

@@ -12,7 +12,7 @@ pub struct FifoCache<Payload: Eq + Hash + Clone + Debug> {
}

impl<Payload: Eq + Hash + Clone + Debug> InstanceCachePolicy<Payload> for FifoCache<Payload> {
fn get(&mut self, key: Payload) -> Option<Payload> {
fn get(&mut self, key: Payload, last_mem_use: f32) -> Option<Payload> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

能不能直接传进来该缓存所在的节点对应的实例的状态,不然后续你扩展新的缓存可能要观测别的数据,又得传新的变量;随着策略增多改动会越来越麻烦

@@ -13,7 +13,7 @@ pub struct LRUCache<Payload: Eq + Hash + Clone + Debug> {
}

impl<Payload: Eq + Hash + Clone + Debug> InstanceCachePolicy<Payload> for LRUCache<Payload> {
fn get(&mut self, key: Payload) -> Option<Payload> {
fn get(&mut self, key: Payload, last_mem_use: f32) -> Option<Payload> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

同上

};
use std::{ collections::HashMap, fs::File };
use std::{collections::HashMap, fs::File, ptr::NonNull};
Copy link
Collaborator

Choose a reason for hiding this comment

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

NonNull 没用去掉吧,可以跑一遍cargo fix

@@ -209,7 +217,7 @@ impl Node {
// self.fn_containers.get(&fnid)
// }

Copy link
Collaborator

Choose a reason for hiding this comment

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

这里加上的注释解释下if down的作用吧

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