feat: lru eviction policy on page caches
[lunaix-os.git] / lunaix-os / includes / lunaix / ds / lru.h
diff --git a/lunaix-os/includes/lunaix/ds/lru.h b/lunaix-os/includes/lunaix/ds/lru.h
new file mode 100644 (file)
index 0000000..5ae607d
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef __LUNAIX_LRU_H
+#define __LUNAIX_LRU_H
+
+#include <lunaix/ds/llist.h>
+
+struct lru_zone
+{
+    struct llist_header lead_node;
+    struct llist_header zones;
+};
+
+struct lru_node
+{
+    struct llist_header lru_nodes;
+};
+
+struct lru_zone*
+lru_new_zone();
+
+void
+lru_use_one(struct lru_zone* zone, struct lru_node* node);
+
+struct lru_node*
+lru_evict_one(struct lru_zone* zone);
+
+void
+lru_remove(struct lru_node* node);
+
+#endif /* __LUNAIX_LRU_H */