Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Remove cache for a particular original #53

Closed
JulienTant opened this issue Mar 26, 2015 · 4 comments
Closed

[Question] Remove cache for a particular original #53

JulienTant opened this issue Mar 26, 2015 · 4 comments

Comments

@JulienTant
Copy link

Hello,

I just wanted to know if there's a way to remove the cache for a particular original picture ?

@schmidex
Copy link

Looking at the source there isn't a feature like this. The problem is, cache files don't have any reference to their original file they were created from. This is because the cache-filenames are simple hashes of the filename+parameters.
Maybe this could be changed to something like this:

// remove folders from filename
$preparedfilename = str_replace('/','-',$filename);
// generate cachefilename
$cachefilename = $preparedfilename . '_' . md5($parameters);

Now a method could do something like this:

public function deleteCache($filename)
{
    $search = $str_replace('/','-',$filename);

    $path = $this->flysystem->listContents('cache-path');
    foreach($path as $file)
    {
        if( some regex) ->delete file
    }
}

@JulienTant
Copy link
Author

Because i'm using a class to generate my configuration arrays instead of using the Request directly, i did a loop over all options and checked if cache exists. If yes, i removed the cache file.

I guess another solution would be to maintain a json file maybe ?

@constb
Copy link

constb commented Mar 31, 2015

maybe a task at hand could be solved by this pull request: #28? I really have no idea why it hasn't been merged yet.

@reinink
Copy link
Contributor

reinink commented Jun 15, 2015

Please see issue #7 for more information on this. To keep things organized, we'll continue this discussion there, and I'm going close this issue.

@constb the reason that PR wasn't merged in was because:

  1. It required extra Flysystem API calls, which can slow things down, especially using an Amazon S3 adapter, or some other non-local adapter.
  2. It doesn't really help at all when the browser has cached the file anyway, since it will never actually hit Glide to check if the freshness has changed.

@reinink reinink closed this as completed Jun 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants