View in #cornerstone3d on Slack
@Johnmark_Enriquez: Hi everyone,
I hope you’re all doing well. Could someone please explain how caching works in Cornerstone, specifically with the Cache.ts
class? I’m curious whether it uses in-memory caching or another method.
Thank you very much!
@Adrien: As far as I know, it’s all in memory at this point. Investigating “spilling” into eg indexeddb would be interesting though
@JamesAPetts: Yeah its all in RAM. The image cache is a stack that pushes images out that haven’t been used recently. The volume cache is more like heap memory that must be managed by the application. It was designed that way as typically you have a low N number of volumes to display at once and each volume is significant in size (a few hundred mb, so the consumer really needs to control it).
cornerstone doesn’t use indexdb OOTB but you can totally store data in indexdb when it comes in, so that if it is decached from RAM you can quickly fetch it from disk again.
@Adrien: There’s no easy way to cache the decoded data though as far as I know… it’d be nice to be able to stream the decoded data (maybe compressed using lzo or zstd if it’s fast enough) directly into a vtk volume.
@JamesAPetts: I mean you can do whatever you want if you write your own image loader
@Alireza_Sedghi: https://www.cornerstonejs.org/docs/concepts/cornerstone-core/cache
Cache | Cornerstone.js