-
Notifications
You must be signed in to change notification settings - Fork 198
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
Is it possible to disable cache? #30
Comments
Not at the moment, no. I had no idea anyone would ever want to that, but that makes sense if you're using Varnish. Can you leave this with me to add a new method for this? For the time being maybe just save the cached files to |
I probably found the solution. IIRC there is a null adapter in flysystem. That might work. |
Haha, yep, that would probably work too. ;) |
Is this repo free for pull requests? I'd like to add something like this: Current situation: /**
* Get the source file system.
* @return FilesystemInterface The source file system.
*/
public function getSource()
{
$source = null;
if (isset($this->config['source'])) {
$source = $this->config['source'];
}
if (is_string($source)) {
return new Filesystem(new Local($source));
}
if ($source instanceof FilesystemInterface) {
return $source;
}
throw new InvalidArgumentException('Invalid `source` parameter.');
} Preferred situation: /**
* Get the source file system.
* @return FilesystemInterface The source file system.
*/
public function getSource()
{
$source = null;
if (isset($this->config['source'])) {
$source = $this->config['source'];
}
if (is_string($source)) {
return new Filesystem($this->adapter($source, $adapterclass));
}
if ($source instanceof FilesystemInterface) {
return $source;
}
throw new InvalidArgumentException('Invalid `source` parameter.');
}
// Add the source and the adapter, f.e. 'League\Flysystem\Adapter\Null'
public function adapter($source, $class)
{
return new $class($source);
} |
Hi @xtrasmal, can you explain to me exactly what you're trying to do? I'm sort of confused. If you're simply trying to pass the Null adapter to the Glide factory you can just do this: $server = League\Glide\ServerFactory::create([
'source' => 'path/to/source/folder',
'cache' => new League\Flysystem\Adapter\Null(),
]); |
Hi @reinink, passing an instance of Flysystem's NullAdapter (there is no Null) as you suggested does not work:
I believe it has to do with the following check on line 86 of ServerFactory.php just before the InvalidArgumentException gets thrown:
Because: NullAdapter extends AbstractAdapter which implements AdapterInterface which extends ReadInterface. So it is not an instance of FilesystemInterface. I believe this is a bug as there is currently no way to turn off caching, which I would like to so as to let a CDN handle caching managed by headers. Thoughts? |
Yeah, agreed, I'll add the option to disable the cache in an upcoming release. |
Is there a way to delete the cached files for a particular image? |
@shyam-achuthan What you're describing is cache invalidation; something that is discussed in another issue. From my understanding, there is currently no cache invalidation handling in Glide. I submitted a pull request to allow disabling of the cache so that caching - and invalidation - could simply be handled by another layer like a CDN (e.g. Amazon CloudFront) or a reverse proxy (e.g. Nginx). |
cache invalidation 👍 |
That is my problem
Met vriendelijke groet, With kind regards, Xander Smalbil Netbulae Virtualization Experts
|
Hey all, I've finally got a good solution to this cache disabling problem. See #56. |
I want to give varnish a try, and I don't want files stored twice in my filesystem. Is it possible to disable cache?
The text was updated successfully, but these errors were encountered: