karlseguin / ccache

A golang LRU Cache for high concurrency
MIT License
1.27k stars 118 forks source link

Refactor control messages + Stop handling #78

Closed karlseguin closed 1 year ago

karlseguin commented 1 year ago

Move the control API shared between Cache and LayeredCache into its own struct. But keep the control logic handling separate - it requires access to the local values, like dropped and deleteItem.

Stop is now a control message. Channels are no longer closed as part of the stop process.

eli-darkly commented 1 year ago

@karlseguin I've rerun my tests using this commit of CCache, with the race detector enabled, and it's no longer flagging a race condition as it did before. I don't think I'll be able to offer any more useful commentary about these changes, and my code doesn't exercise a lot of CCache's features so my tests might not detect any other problems, but for what it's worth, it does seem better in that regard.