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
I love awesomecache though I ran into something interesting the other day. I was looking at a cache I had written for some API and because of the naming convention for setObjectForKey("name", cacheBlock: {}, completion: {}, I thought I was never checking this cache for the object before I was running the cacheBlock. I realized how this actually works later when I referred to the github page again and I re-read the example: "If the cache already contains an object, the completion block is called with the cached object immediately."
This would probably be more clear if it was named checkObjectForKey or something similar. That better represents that the function doesn't just blindly run and set the object, but rather checks the cache and can hit completion immediately.
The text was updated successfully, but these errors were encountered:
Hey there,
I love awesomecache though I ran into something interesting the other day. I was looking at a cache I had written for some API and because of the naming convention for
setObjectForKey("name", cacheBlock: {}, completion: {}
, I thought I was never checking this cache for the object before I was running the cacheBlock. I realized how this actually works later when I referred to the github page again and I re-read the example: "If the cache already contains an object, the completion block is called with the cached object immediately."This would probably be more clear if it was named
checkObjectForKey
or something similar. That better represents that the function doesn't just blindly run and set the object, but rather checks the cache and can hit completion immediately.The text was updated successfully, but these errors were encountered: