AwesomeCache icon indicating copy to clipboard operation
AwesomeCache copied to clipboard

Confusing API caching method names

Open nickoneill opened this issue 10 years ago • 1 comments

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.

nickoneill avatar Aug 13 '15 21:08 nickoneill

Make sense. +1 for checkObjectForKey

lexrus avatar Oct 26 '15 13:10 lexrus