You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it looks like struct cache is unnecessary in the code. I notice the comment // If this is confusing, see the comment at the bottom of New(), but i didn't find any explaination
The text was updated successfully, but these errors were encountered:
IMO, Since, the janitor is working in a go routine on cache , c object. It will never be available for garbage collection. Hence, Cache struct is designed to have cache as a field. If Cache struct is garbage collected, stopJanitor is called using the runtime.setFinalizer. runtime.setFinalizer is used to call a function, here stopJanitor, when the first operand , here C, is garbage collected.
it looks like struct
cache
is unnecessary in the code. I notice the comment // If this is confusing, see the comment at the bottom of New(), but i didn't find any explainationThe text was updated successfully, but these errors were encountered: