Gregwar/Cache — pull request #7 by jeremyclement (2014-03-17 15:57:48+00:00)
Title: add chmod function

You can now choose permission mode of your cache files and folders.

### use example ###

```php
$cache = new \Gregwar\Cache\Cache;
$cache->setCacheDirectory($cache_dir);
$old = umask(0);
$cache->chmod(0775,0664);

// get cache or convert
$img_out_path = $cache->getOrCreateFile($img_out,
array(
'younger-than' => $img_src_path
),
function($cached_file){
// resize image
global $img_out_size, $img_src_path;
$command = "convert -filter Lanczos -background none -resize "
. escapeshellarg($img_out_size) ." "
. escapeshellarg($img_src_path) . " "
. escapeshellarg($cached_file);
return exec($command);
});
umask($old);
```

### result cache content ###
```bash
16:41:06 [jclement@baker11:/srv/www/.handlers/flyresizr/.cache] cache(+3/-0) ± tree -pgu
.
`-- [drwxrwxr-x apache apache ] local.sites
`-- [drwxrwxr-x apache apache ] l
`-- [drwxrwxr-x apache apache ] i
`-- [drwxrwxr-x apache apache ] n
`-- [drwxrwxr-x apache apache ] k
`-- [drwxrwxr-x apache apache ] -
`-- [-rw-rw-r-- apache apache ] link-200x.png
```