Andrey Danilov
Andrey Danilov

Reputation: 6602

Glide caching behaviour

I have simple caching problem: I have old "name.jpg", then customer uploads new "name.jpg" and clients dont see any changes, for them its still cached old "name.jpg".

I know how to turn off caching, but its not good decision, so I try to find better.

So question is:

How does caching work if I add get parameter after question mark?

For example I have url

http://example.com/name.jpg?cache_time=111

And then I replace it to

http://example.com/name.jpg?cache_time=222

Will it download second name.jpg and replace existing or not? I know its work with css or js files in browser, but know nothing about glide behaviour.

Upvotes: 1

Views: 1084

Answers (1)

Tim
Tim

Reputation: 43364

Whatever parameters you pass in the url query will be sent to the server serving the image and only if that server handles that exact parameter (cache_time) can there be any difference in behavior.

The caching glide does however is not based on what you send to the server, but rather on the configuration you give to glide.

I suggest you look up how glide handles caching, and perhaps manually invalidate the cache for a specific image when you know it has changed.

This is a good place to start: Remove image from cache in Glide library. It also has examples how to use signature()that is mentioned in the comment above.

Upvotes: 1

Related Questions