{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react/issues/13337","repository_url":"https://api.github.com/repos/facebook/react","labels_url":"https://api.github.com/repos/facebook/react/issues/13337/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react/issues/13337/comments","events_url":"https://api.github.com/repos/facebook/react/issues/13337/events","html_url":"https://github.com/facebook/react/pull/13337","id":348144735,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA2NTY0MTkw","number":13337,"title":"[simple-cache-provider] New implementation","user":{"login":"acdlite","id":3624098,"node_id":"MDQ6VXNlcjM2MjQwOTg=","avatar_url":"https://avatars0.githubusercontent.com/u/3624098?v=4","gravatar_id":"","url":"https://api.github.com/users/acdlite","html_url":"https://github.com/acdlite","followers_url":"https://api.github.com/users/acdlite/followers","following_url":"https://api.github.com/users/acdlite/following{/other_user}","gists_url":"https://api.github.com/users/acdlite/gists{/gist_id}","starred_url":"https://api.github.com/users/acdlite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acdlite/subscriptions","organizations_url":"https://api.github.com/users/acdlite/orgs","repos_url":"https://api.github.com/users/acdlite/repos","events_url":"https://api.github.com/users/acdlite/events{/privacy}","received_events_url":"https://api.github.com/users/acdlite/received_events","type":"User","site_admin":false},"labels":[{"id":196858374,"node_id":"MDU6TGFiZWwxOTY4NTgzNzQ=","url":"https://api.github.com/repos/facebook/react/labels/CLA%20Signed","name":"CLA Signed","color":"e7e7e7","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-08-07T02:37:21Z","updated_at":"2018-10-01T16:34:55Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/facebook/react/pulls/13337","html_url":"https://github.com/facebook/react/pull/13337","diff_url":"https://github.com/facebook/react/pull/13337.diff","patch_url":"https://github.com/facebook/react/pull/13337.patch"},"body":"## Based on #13293\r\n\r\nAn updated implementation of simple-cache-provider (final name TBD) using `Context.set` and `Context.read`.\r\n\r\n- [x] Subscription support. `load` accepts a promise or an observable as its return value.\r\n- [x] Default to LRU cache that is shared across resources\r\n- [x] Use `calculateChangedBits` API to optimize updates\r\n\r\nThings I'll probably defer until later since they aren't required for an MVP:\r\n- Support overriding global cache implementation\r\n- Support overriding cache implementation for a subtree"},"comment":{"url":"https://api.github.com/repos/facebook/react/issues/comments/425974864","html_url":"https://github.com/facebook/react/pull/13337#issuecomment-425974864","issue_url":"https://api.github.com/repos/facebook/react/issues/13337","id":425974864,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNTk3NDg2NA==","user":{"login":"jaredpalmer","id":4060187,"node_id":"MDQ6VXNlcjQwNjAxODc=","avatar_url":"https://avatars2.githubusercontent.com/u/4060187?v=4","gravatar_id":"","url":"https://api.github.com/users/jaredpalmer","html_url":"https://github.com/jaredpalmer","followers_url":"https://api.github.com/users/jaredpalmer/followers","following_url":"https://api.github.com/users/jaredpalmer/following{/other_user}","gists_url":"https://api.github.com/users/jaredpalmer/gists{/gist_id}","starred_url":"https://api.github.com/users/jaredpalmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaredpalmer/subscriptions","organizations_url":"https://api.github.com/users/jaredpalmer/orgs","repos_url":"https://api.github.com/users/jaredpalmer/repos","events_url":"https://api.github.com/users/jaredpalmer/events{/privacy}","received_events_url":"https://api.github.com/users/jaredpalmer/received_events","type":"User","site_admin":false},"created_at":"2018-10-01T16:34:55Z","updated_at":"2018-10-01T16:34:55Z","author_association":"NONE","body":"Just summarizing these API changes for reference as I wasn't able to find them documented elsewhere:\r\n\r\n- `createResource` now has support for subscriptions. You return an object with a `subscribe` key which sets up the subscription, and it can return another fn for teardown.\r\n- Breaking Change: `Resource.read()` no longer needs `cache` instance as first argument, just the input.\r\n\r\n**New Resource API**\r\n\r\n- `Resource.preload(input)`: Preload a value in the cache\r\n- `Resource.read(input)`: Read a value from the cache\r\n\r\n**New Cache API**\r\n\r\n- `useCache()`: Get cache via context (calls `Context.unstable_read()`)\r\n- `cache.set(resource, input, value)`: Set a value in the cache\r\n- `cache.purge()`: Wipe the LRU cache\r\n- `cache.invalidate(resource, input)`: Invalidate an item in the cache, given a resource and input (will run the hash fn, if it was provided to resource) \r\n- `setGlobalCacheLimit(limit)`: Set global LRU cache size\r\n"}}
{"actor":{"display_login":"jaredpalmer"}}