I want to caching some response with symfonycache. But I've got some error with my cache and sometime with the symfony default cache.
Configuration :
Debian 9 on vagrant (with vagrant bindfs link to source code directory)
with Apache2
php 7.2 / symfony 4.1
apcu enabled
For caching my response I use the FilesystemAdapter with dir {projectDir}/var/cache/{env}/api-cache and namespace app.cache
var/cache/
drwxrwxrwx 24 vagrant www-data 768 Apr 24 09:09 dev/
drwxrwxrwx 13 vagrant www-data 416 Apr 18 16:02 test/
var/cache/dev/
-rw-rw-rw- 1 vagrant www-data 165 Apr 24 09:09 annotations.map
-rw-rw-rw- 1 vagrant www-data 12K Apr 24 09:09 annotations.php
drwxrwxrwx 3 vagrant www-data 96 Apr 23 17:47 api-cache/
drwxrwxrwx 399 vagrant www-data 13K Apr 23 17:46 ContainerBrT4sD3/
-rw-rw-rw- 1 vagrant www-data 0 Apr 24 09:07 ContainerBrT4sD3.legacy
drwxrwxrwx 404 vagrant www-data 13K Apr 24 09:09 ContainerSaE63B9/
drwxrwxrwx 3 vagrant www-data 96 Apr 23 17:46 doctrine/
drwxrwxrwx 6 vagrant www-data 192 Apr 23 17:47 jms_serializer/
drwxrwxrwx 5 vagrant www-data 160 Apr 24 09:07 pools/
-rw-rw-rw- 1 vagrant www-data 220K Apr 24 09:09 srcDevDebugProjectContainerCompiler.log
-rw-rw-rw- 1 vagrant www-data 1.1K Apr 24 09:09 srcDevDebugProjectContainerDeprecations.log
-rw-rw-rw- 1 vagrant www-data 767 Apr 24 09:09 srcDevDebugProjectContainer.php
-rw-rw-rw- 1 vagrant www-data 58K Apr 24 09:09 srcDevDebugProjectContainer.php.meta
-rw-rw-rw- 1 vagrant www-data 49K Apr 23 17:46 srcDevDebugProjectContainerUrlGenerator.php
-rw-rw-rw- 1 vagrant www-data 5.4K Apr 23 17:46 srcDevDebugProjectContainerUrlGenerator.php.meta
-rw-rw-rw- 1 vagrant www-data 78K Apr 23 17:46 srcDevDebugProjectContainerUrlMatcher.php
-rw-rw-rw- 1 vagrant www-data 5.4K Apr 23 17:46 srcDevDebugProjectContainerUrlMatcher.php.meta
-rw-rw-rw- 1 vagrant www-data 519K Apr 24 09:09 srcDevDebugProjectContainer.xml
-rw-rw-rw- 1 vagrant www-data 58K Apr 24 09:09 srcDevDebugProjectContainer.xml.meta
drwxrwxrwx 108 vagrant www-data 3.4K Apr 23 17:46 translations/
drwxrwxrwx 142 vagrant www-data 4.5K Apr 24 09:09 twig/
-rw-rw-rw- 1 vagrant www-data 91 Apr 24 09:09 validation.php
Log for default symfony code :
cache.WARNING: Failed to save key "%5B%5BC%5DApp%5CEntity%5CReport%5CReportItem%24hasBeenPushed%5D%5B1%5D" (integer) {"key":"%5B%5BC%5DApp%5CEntity%5CReport%5CReportItem%24hasBeenPushed%5D%5B1%5D","type":"integer","exception":"[object] (ErrorException(code: 0): touch(): Utime failed: Operation not permitted at /vagrant-bindfs/vendor/symfony/cache/Traits/FilesystemCommonTrait.php:90)"} []
Logs with my code :
php.DEBUG: User Warning: Failed to save key "my_tag" (string) {"exception":"[object] (Symfony\Component\Debug\Exception\SilencedErrorContext: {"severity":512,"file":"/vagrant-bindfs/vendor/symfony/cache/CacheItem.php","line":184,"trace":[{"file":"/vagrant-bindfs/vendor/symfony/cache/Adapter/AbstractAdapter.php","line":242,"function":"log","class":"Symfony\\Component\\Cache\\CacheItem","type":"::"}],"count":1})"} []
app.ERROR: Cache not save : my_tag [] []
When I log some information about the exception in SymfonyComponentCacheAdapterAbstractAdapter->commit() I got this :
ErrorException
touch(): Utime failed: Operation not permitted
I already search a solution but nothing works.
I think it's a problem of right on the cache directories and maybe a problem with vagrant and vagrant-binfs but I do not understand it.
What can I do/check to solve this ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…