{"action":"created","issue":{"url":"https://api.github.com/repos/bcosca/fatfree-core/issues/98","labels_url":"https://api.github.com/repos/bcosca/fatfree-core/issues/98/labels{/name}","comments_url":"https://api.github.com/repos/bcosca/fatfree-core/issues/98/comments","events_url":"https://api.github.com/repos/bcosca/fatfree-core/issues/98/events","html_url":"https://github.com/bcosca/fatfree-core/issues/98","id":116956274,"number":98,"title":"Suggestion: script-wide cache","user":{"login":"xfra35","id":1838531,"avatar_url":"https://avatars.githubusercontent.com/u/1838531?v=3","gravatar_id":"","url":"https://api.github.com/users/xfra35","html_url":"https://github.com/xfra35","followers_url":"https://api.github.com/users/xfra35/followers","following_url":"https://api.github.com/users/xfra35/following{/other_user}","gists_url":"https://api.github.com/users/xfra35/gists{/gist_id}","starred_url":"https://api.github.com/users/xfra35/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xfra35/subscriptions","organizations_url":"https://api.github.com/users/xfra35/orgs","repos_url":"https://api.github.com/users/xfra35/repos","events_url":"https://api.github.com/users/xfra35/events{/privacy}","received_events_url":"https://api.github.com/users/xfra35/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-11-14T22:32:51Z","updated_at":"2015-11-17T09:53:48Z","closed_at":null,"body":"Would it make sense to have the possibility to cache values for the duration of the script?\r\n\r\nI'm thinking about mapper optimization (lazy-loaded mappers on a collection) but that could be useful for long running scripts as well.\r\n\r\nAs for the syntax, I was thinking about `$ttl=-1` to trigger the behaviour.\r\n\r\nSo if we had `$cache->set('mykey',123,-1)` or `$db->exec($sql,$args,-1)`, the stored values would be available during the script life and destroyed at shutdown. I guess they would have to be stored in an array instead of the cache backend.\r\n\r\nIt may be a dummy idea after all, so I'm waiting for your feedback =)"},"comment":{"url":"https://api.github.com/repos/bcosca/fatfree-core/issues/comments/157323567","html_url":"https://github.com/bcosca/fatfree-core/issues/98#issuecomment-157323567","issue_url":"https://api.github.com/repos/bcosca/fatfree-core/issues/98","id":157323567,"user":{"login":"ikkez","id":1177647,"avatar_url":"https://avatars.githubusercontent.com/u/1177647?v=3","gravatar_id":"","url":"https://api.github.com/users/ikkez","html_url":"https://github.com/ikkez","followers_url":"https://api.github.com/users/ikkez/followers","following_url":"https://api.github.com/users/ikkez/following{/other_user}","gists_url":"https://api.github.com/users/ikkez/gists{/gist_id}","starred_url":"https://api.github.com/users/ikkez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ikkez/subscriptions","organizations_url":"https://api.github.com/users/ikkez/orgs","repos_url":"https://api.github.com/users/ikkez/repos","events_url":"https://api.github.com/users/ikkez/events{/privacy}","received_events_url":"https://api.github.com/users/ikkez/received_events","type":"User","site_admin":false},"created_at":"2015-11-17T09:53:48Z","updated_at":"2015-11-17T09:53:48Z","body":"Sound like you want to add a transient cache implementation that just saves anything in an array instead of a cache backend. That should be as easy as writing a custom Cache Class that implements all needed methods (`get`, `set`, `del`, `keys`) and just put everything into a global array.. check the [predis thread on the board](https://groups.google.com/d/msg/f3-framework/FjJT0Ie6LKU/bLfyb8uiCAAJ)\r\n\r\nregarding mapper optimization, please tell us more. As far as I can see, mappers are already \"lazy-loaded\". The result of the db is stored in `$this->query` and the mapper object itself is loaded with the `factory` method once you move the pointer to that record."}}