allows the control of files and folders permissions.

*I cleaned errors and added more checks, I hope that you ca be.*

You can better control permissions of your cache files and folders.

### use example ###

```php
// set cache
$cache = new \Gregwar\Cache\Cache;
$cache->setCacheDirectory($cache_dir);

// choose directories rights 
// -------------------------------
// with umask and default value of mkdir (0777)
// umask(0002);
// or with new method
$old = umask(0); //default is 0002 or 0022 according to configs
$cache->setDefaultDirMode(0775)


// get cache or convert 
$img_out_path = $cache->getOrCreateFile($img_out,
    array(
        'younger-than' => $img_src_path
    ),
    function($cached_file){
        // create cached file
        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);
        exec($command);
        
        //can choose file permissions with built-in chmod function
        chmod($cached_file,0664);
    });
umask($old);

// you can also use Cache::chmod() for change permissions of current cache
$cache->chmod(755, 644);
```
### result cache content ###
```bash
18:16:26 [jclement@thror:/srv/www/.handlers/flyresizr/.cache] cache(+3/-0) ± tree -pgu
.
`-- [drwxr-xr-x apache   apache  ]  local.sites
    `-- [drwxr-xr-x apache   apache  ]  l
        `-- [drwxr-xr-x apache   apache  ]  i
            `-- [drwxr-xr-x apache   apache  ]  n
                `-- [drwxr-xr-x apache   apache  ]  k
                    `-- [drwxr-xr-x apache   apache  ]  -
                        `-- [-rw-r--r-- apache   apache  ]  link-200x.png
```