S
S
Serghei Niculaev2015-06-22 17:22:35
symfony
Serghei Niculaev, 2015-06-22 17:22:35

How to prevent Symfony from caching a specific file?

I need to exclude a file from the cache that needs to be updated very often. How to make sure that it never gets cached at all?
Updated: Generation is done by a command on the server, via cron (or manually), then the data is written to a local file, and then issued to the user when he enters the "export" routing.
It is desirable to remove both the file and the command and the controller that issues the file from caching, but the primer is enough for me. I did not find anything sensible on en_US sites.
Updated: I have an export.xml file on the server, which is filled with some amount of data with each command. There is a third-party server that accepts this file by reference. For the uniqueness of each export, there is a script on the server that issues it with the name "export_20150623093750.xml" where after "export_" there is simply "YmdHis". The problem is that after giving me such a file once, for some time the server gives me the same file with the same name, that is, it does not update it at all before downloading, but essentially gives out its cached version. The bottom line is not even in the name, but in the fact that the export file, despite the fact that I even manually update it, does not change when loaded.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Serghei Niculaev, 2015-06-23
@spam312sn

Solved a problem. It was buried in nginx.

location ~* .(xml)$ {
add_header Expires -1;
log_not_found off; 
}

S
Stalker_RED, 2015-06-22
@Stalker_RED

symfony.com/doc/2.0/reference/configuration/twig.html
cache parameter isn't it?

D
Denis, 2015-06-22
@prototype_denis

The cache is configured in the response headers.
https://symfony.com/doc/current/book/http_cache.ht...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question