{"action":"created","issue":{"url":"https://api.github.com/repos/thephpleague/glide/issues/7","labels_url":"https://api.github.com/repos/thephpleague/glide/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/thephpleague/glide/issues/7/comments","events_url":"https://api.github.com/repos/thephpleague/glide/issues/7/events","html_url":"https://github.com/thephpleague/glide/issues/7","id":53220907,"number":7,"title":"Cleaning up the cache","user":{"login":"reinink","id":882133,"avatar_url":"https://avatars.githubusercontent.com/u/882133?v=3","gravatar_id":"","url":"https://api.github.com/users/reinink","html_url":"https://github.com/reinink","followers_url":"https://api.github.com/users/reinink/followers","following_url":"https://api.github.com/users/reinink/following{/other_user}","gists_url":"https://api.github.com/users/reinink/gists{/gist_id}","starred_url":"https://api.github.com/users/reinink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reinink/subscriptions","organizations_url":"https://api.github.com/users/reinink/orgs","repos_url":"https://api.github.com/users/reinink/repos","events_url":"https://api.github.com/users/reinink/events{/privacy}","received_events_url":"https://api.github.com/users/reinink/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/thephpleague/glide/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":17,"created_at":"2015-01-01T14:37:45Z","updated_at":"2015-07-27T21:43:35Z","closed_at":null,"body":"Currently Glide does not do any cache cleanup, meaning it generates manipulated images and places them into the cache file system, but it never deletes them. It's possible that over time this cache gets large and contains many unused image manipulations.\r\n\r\nThe simple solution here is to simply delete the entire cache periodically, and on small projects this is probably fine. But on larger projects it could be problematic since all image manipulations will have to be regenerated.\r\n\r\nIt would probably be good if Glide came with a `CacheCleanup` helper. This cleanup tool could be run every time a request is received, or it could be setup with a scheduler (probably better). Something like:\r\n\r\n```php\r\n$cache = new Filesystem(new LocalAdapter('cache-folder'));\r\n$cleanup = new CacheCleanup($cache)\r\n$cleanup->expire(2592000); // 30 days\r\n```\r\n\r\nThis approach would delete any manipulations older than 30 days. This can be determined easily use the `$filesystem->getTimestamp()` method.\r\n\r\nHowever, this technique will not take into consideration whether they are being actively accessed or not. Using the last accessed date would be much more complicated since this information is not readily available. To do this you would need to create a data store, and save this information every time a manipulation is created. I feel this falls outside of the scope of this project. If this sort of cache cleanup is needed, developers are welcome to implement this themselves."},"comment":{"url":"https://api.github.com/repos/thephpleague/glide/issues/comments/125350844","html_url":"https://github.com/thephpleague/glide/issues/7#issuecomment-125350844","issue_url":"https://api.github.com/repos/thephpleague/glide/issues/7","id":125350844,"user":{"login":"reinink","id":882133,"avatar_url":"https://avatars.githubusercontent.com/u/882133?v=3","gravatar_id":"","url":"https://api.github.com/users/reinink","html_url":"https://github.com/reinink","followers_url":"https://api.github.com/users/reinink/followers","following_url":"https://api.github.com/users/reinink/following{/other_user}","gists_url":"https://api.github.com/users/reinink/gists{/gist_id}","starred_url":"https://api.github.com/users/reinink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reinink/subscriptions","organizations_url":"https://api.github.com/users/reinink/orgs","repos_url":"https://api.github.com/users/reinink/repos","events_url":"https://api.github.com/users/reinink/events{/privacy}","received_events_url":"https://api.github.com/users/reinink/received_events","type":"User","site_admin":false},"created_at":"2015-07-27T21:43:35Z","updated_at":"2015-07-27T21:43:35Z","body":"This feature should now be fixed. (5ededaed6dd785c825ee6922e9af9a99e0da8e6a)"}}