Skip to content

Commit 335b1e9

Browse files
committed
[Docs] Fix the illustration of plugin workflow
1 parent 66df264 commit 335b1e9

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

doc/quickstart_plugin.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ graph LR
1717
D -->|No| F{libCacheSim Cache Full?}
1818
F -->|Yes| G["cache_eviction_hook()<br/>plugin cache determines the object(s) to evict"]
1919
F -->|No| H["cache_miss_hook()<br/>Update plugin cache stats"]
20-
G --> H
20+
G --> F
2121
2222
style E fill:#bfb,stroke:#333,stroke-width:2px
2323
style G fill:#fbb,stroke:#333,stroke-width:2px
@@ -300,6 +300,28 @@ For Python examples, see the `libCacheSim-python/README.md` file which contains
300300
* **Performance Issues**: Use `process_trace()` for large workloads instead of individual `get()` calls for better performance.
301301
* **Memory Usage**: Monitor cache statistics (`cache.occupied_byte`) and ensure proper cache size limits for your system.
302302
* **Custom Cache Issues**: Validate your custom implementation against built-in algorithms using test functions.
303+
* **Implementation Issues**: When re-implementing an eviction algorithm in libCacheSim using the plugin system, note that the core hook functions are simplified. This may introduce some challenges.
304+
305+
The central function for cache simulation is get:
306+
307+
!!! note
308+
Cache state is updated automatically, since update_cache = true by default.
309+
310+
```mermaid
311+
graph LR
312+
C[find] --> D{Found in cache?}
313+
D -->|Yes| E["cache_hit_hook()"]
314+
D -->|No| F{"Cache full?"}
315+
F -->|"Yes (no space for new object)"| G["cache_eviction_hook()"]
316+
F -->|No| H["cache_miss_hook()"]
317+
G --> F
318+
319+
style E fill:#bfb,stroke:#333,stroke-width:2px
320+
style G fill:#fbb,stroke:#333,stroke-width:2px
321+
style H fill:#bbf,stroke:#333,stroke-width:2px
322+
```
323+
324+
Because find is not exposed to plugins, any state-update logic that normally happens inside find must instead be implemented inside the relevant hook functions (cache_hit_hook, cache_eviction_hook, or cache_miss_hook) according to your algorithm’s needs.
303325

304326
---
305327

0 commit comments

Comments
 (0)