{"action":"created","issue":{"url":"https://api.github.com/repos/yahoo/YMCache/issues/16","labels_url":"https://api.github.com/repos/yahoo/YMCache/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/yahoo/YMCache/issues/16/comments","events_url":"https://api.github.com/repos/yahoo/YMCache/issues/16/events","html_url":"https://github.com/yahoo/YMCache/pull/16","id":111082878,"number":16,"title":"Crash on cache eviction","user":{"login":"e28eta","id":483223,"avatar_url":"https://avatars.githubusercontent.com/u/483223?v=3","gravatar_id":"","url":"https://api.github.com/users/e28eta","html_url":"https://github.com/e28eta","followers_url":"https://api.github.com/users/e28eta/followers","following_url":"https://api.github.com/users/e28eta/following{/other_user}","gists_url":"https://api.github.com/users/e28eta/gists{/gist_id}","starred_url":"https://api.github.com/users/e28eta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/e28eta/subscriptions","organizations_url":"https://api.github.com/users/e28eta/orgs","repos_url":"https://api.github.com/users/e28eta/repos","events_url":"https://api.github.com/users/e28eta/events{/privacy}","received_events_url":"https://api.github.com/users/e28eta/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-10-13T01:02:49Z","updated_at":"2015-10-13T01:30:21Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/yahoo/YMCache/pulls/16","html_url":"https://github.com/yahoo/YMCache/pull/16","diff_url":"https://github.com/yahoo/YMCache/pull/16.diff","patch_url":"https://github.com/yahoo/YMCache/pull/16.patch"},"body":"`YMMemoryCache` seems broken. The [documentation for NSMutableDictionary setObject:forKeyedSubscript:](https://developer.apple.com/library/prerelease/ios//documentation/Cocoa/Reference/Foundation/Classes/NSMutableDictionary_Class/index.html#//apple_ref/occ/instm/NSMutableDictionary/setObject:forKeyedSubscript:) says\r\n\r\n> \"IMPORTANT Raises an NSInvalidArgumentException if anObject is nil.\"\r\n\r\nHowever, there are several places where the code explicitly uses keyed subscripting to try to set an object to `nil` to clear it out. For example `removeObjectsForKeys:`\r\n\r\nI was going to write a unit test that shows this behavior, but the existing tests already fail due to this: \r\n\r\n    Test Case '-[YMMemoryCacheSpecSpec test_YMMemoryCache__Single_setter__Should_unset_value_via_keyed_subscripting]' started.\r\n    2015-10-12 17:52:02.190 xctest[16403:178104] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** setObjectForKey: object cannot be nil (key: Key2)'\r\n\r\nI'm using Xcode 6.4, developing against iOS 8.x with Objective-C, but I can't find any documentation (neither iOS 9 nor Mac) that says this is allowed.\r\n\r\nI noticed the problem the first time I evicted my cache: it immediately crashed. The YMMemoryCache documentation says the cache allows setting nil objects, but since it passes the object directly to NSMutableDictionary, I think that's broken too.\r\n\r\nAm I missing something? Thanks!"},"comment":{"url":"https://api.github.com/repos/yahoo/YMCache/issues/comments/147569214","html_url":"https://github.com/yahoo/YMCache/pull/16#issuecomment-147569214","issue_url":"https://api.github.com/repos/yahoo/YMCache/issues/16","id":147569214,"user":{"login":"yahoocla","id":6155154,"avatar_url":"https://avatars.githubusercontent.com/u/6155154?v=3","gravatar_id":"","url":"https://api.github.com/users/yahoocla","html_url":"https://github.com/yahoocla","followers_url":"https://api.github.com/users/yahoocla/followers","following_url":"https://api.github.com/users/yahoocla/following{/other_user}","gists_url":"https://api.github.com/users/yahoocla/gists{/gist_id}","starred_url":"https://api.github.com/users/yahoocla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yahoocla/subscriptions","organizations_url":"https://api.github.com/users/yahoocla/orgs","repos_url":"https://api.github.com/users/yahoocla/repos","events_url":"https://api.github.com/users/yahoocla/events{/privacy}","received_events_url":"https://api.github.com/users/yahoocla/received_events","type":"User","site_admin":false},"created_at":"2015-10-13T01:30:21Z","updated_at":"2015-10-13T01:30:21Z","body":"CLA is valid!"}}