UserSearchSettings.write("sort_by", "name")
=> true
NSUserDefaults.standardUserDefaults.dictionaryRepresentation
=> {"user_search_sort_by" => "name"} # note there will be a lot of other key values in the hash
UserSearchSettings.read("sort_by")
=> "name"

My intention is not to call the Cache class directly and to only use the subclass UserSearchSettings. This forces me to group settings with a prefix defined by the cache_namespace method. This will help avoid accidentally defining the same key name for different values. It also nicely groups related settings.

Each application has its’ own NSUserDefaults.standardUserDefaults so there is no need to prefix the keys with the application name.

This store will persist until the user removes your application from their device.