{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/Haxl/issues/32","labels_url":"https://api.github.com/repos/facebook/Haxl/issues/32/labels{/name}","comments_url":"https://api.github.com/repos/facebook/Haxl/issues/32/comments","events_url":"https://api.github.com/repos/facebook/Haxl/issues/32/events","html_url":"https://github.com/facebook/Haxl/issues/32","id":93802155,"number":32,"title":"bounded caches","user":{"login":"kantp","id":1433735,"avatar_url":"https://avatars.githubusercontent.com/u/1433735?v=3","gravatar_id":"","url":"https://api.github.com/users/kantp","html_url":"https://github.com/kantp","followers_url":"https://api.github.com/users/kantp/followers","following_url":"https://api.github.com/users/kantp/following{/other_user}","gists_url":"https://api.github.com/users/kantp/gists{/gist_id}","starred_url":"https://api.github.com/users/kantp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kantp/subscriptions","organizations_url":"https://api.github.com/users/kantp/orgs","repos_url":"https://api.github.com/users/kantp/repos","events_url":"https://api.github.com/users/kantp/events{/privacy}","received_events_url":"https://api.github.com/users/kantp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-08T14:26:22Z","updated_at":"2015-07-08T15:11:30Z","closed_at":null,"body":"Hi there,\r\n\r\nI've been using this great library for some time now, thanks for opening it up to the public!\r\n\r\nMy use case involves large amounts of data, so I had to change the library slightly to be able to use a bounded cache. I have made it configurable so that each type of request can either use a bounded cache of a given size, or an unbounded cache.\r\n\r\nIn order to configure it, I have added an additional typeclass that has a DataSource has to be an instance of. It has a single function, cacheSize, that determines the size of the cache for each request (which may be infinite).\r\n\r\nIf this is useful to other people, I'd be glad to do a pull request. Notice however, that this would be a breaking change, since all DataSources have to add an instance of the new typeclass (which is easy to do).\r\n\r\nI have not yet added tests that check that the cache stays within the specified bounds, nor done benchmarks (but it's on my agenda).\r\n\r\nBest,\r\nPhilipp"},"comment":{"url":"https://api.github.com/repos/facebook/Haxl/issues/comments/119619066","html_url":"https://github.com/facebook/Haxl/issues/32#issuecomment-119619066","issue_url":"https://api.github.com/repos/facebook/Haxl/issues/32","id":119619066,"user":{"login":"simonmar","id":609606,"avatar_url":"https://avatars.githubusercontent.com/u/609606?v=3","gravatar_id":"","url":"https://api.github.com/users/simonmar","html_url":"https://github.com/simonmar","followers_url":"https://api.github.com/users/simonmar/followers","following_url":"https://api.github.com/users/simonmar/following{/other_user}","gists_url":"https://api.github.com/users/simonmar/gists{/gist_id}","starred_url":"https://api.github.com/users/simonmar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonmar/subscriptions","organizations_url":"https://api.github.com/users/simonmar/orgs","repos_url":"https://api.github.com/users/simonmar/repos","events_url":"https://api.github.com/users/simonmar/events{/privacy}","received_events_url":"https://api.github.com/users/simonmar/received_events","type":"User","site_admin":false},"created_at":"2015-07-08T15:11:30Z","updated_at":"2015-07-08T15:11:30Z","body":"I can understand the need to limit the cache size in certain use cases.  However, as soon as we stop caching everything, we lose the nice replayability property that Haxl has now: the cache is a complete record of the execution, and the request can be replayed without fetching any data.\r\n\r\nSo I'm open to doing this so long as we can make it non-invasive, and make it clear that it breaks replayability."}}