blob: 699f9f3a30d1ee208b0e92d5d67c142328917c53 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
|
- each thing that references something holds a reference to it, guaranteeing that it is stored in the cache.
- if all the references are dropped, it is removed from the cache.
- if you query the cache with an id you should be able to get a reference.
- but the issue is that the underlying data can change when the value in the cache changes. therefore, the reference must be a reference to a mutex.
- so then use generational thing
- the cache also needs to be in a mutex, because the cache must be modifiable through the drop function and the main logic.
- the drop function doesn't have to be able to modify the cache, it can just let the program know it's time to delete something from the cache.
- the generational thing means that it will be auto-dropped.
arena that has a hashmap along with it. the hashmap has the id and the generation index. if the generation thing is fucked, then it falls back to the hashmap to change the index. changing the hashmap unfortunately requires mutex. the key is self referential to the macaw struct.
|