karlseguin / ccache

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

Avoid blocking if promotables channel is full. #52

Closed gopalmor closed 3 years ago

gopalmor commented 3 years ago

In rare situation it is possible to have promotables channel full. In such condition, the Get function will be blocked because it calls promote function. Get function being blocked defeats the purpose of fast cache response and hence may impact the application code in unexpected manner. In this commit, the promote function is modified to use non-blocking channel send construct.

karlseguin commented 3 years ago

nice, thanks