Questions tagged [symfony-cache]

The tag is for Symfony Cache Component which was introduced in Symfony 3.1

Symfony Cache Component https://symfony.com/doc/current/components/cache.html was introduced in Symfony 3.1

24 questions
5
votes
5 answers

composer install or update error, what is wrong

I have a problem. After command composer update I get error message [Symfony\Component\Console\Exception\LogicException] An option named "connection" already exists. Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache…
5
votes
2 answers

Large image folder crashes Symfony "cache:clear" with OutOfMemoryException

When I put a large image folder in my /web folder, the "cache"clear" command fails with a "OutOfMemoryException" PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 151552 bytes) in…
BigJ
  • 1,990
  • 2
  • 29
  • 47
4
votes
2 answers

How to share the application cache between multiple Symfony instances (shared cache pool)?

My symfony application has multiple instances that are running in seperate docker containers. And I have configured my app.cache to use redis: framework: cache: app: cache.adapter.redis I have the same prefix_seed: framework: …
alvery
  • 1,863
  • 2
  • 15
  • 35
4
votes
1 answer

Setup of Symfony 3.1 cache component with Redis

I try to setup Symfony 3.1 cache with Redis. I follow this tutorial: https://symfony.com/blog/new-in-symfony-3-1-cache-component I've installed predis/predis and SncRedisBundle. In my config.yml I've put framework: cache: app:…
Robert
  • 19,800
  • 5
  • 55
  • 85
2
votes
2 answers

How to inject a specific cache pool?

In my Symfony 5 application I want to use different caches for different tasks and of course for different environments. e.g. my configuration looks like this: framework: cache: pools: cache.auth: adapter:…
Calamity Jane
  • 2,189
  • 5
  • 36
  • 68
2
votes
1 answer

Pass parameters to Symfony's $cache->get()

I am afraid I have a beginners PHP question. I am using Symfony's Cache component. https://symfony.com/doc/current/components/cache.html I am calling the cache object inside of a function which receives 2 arguments ($url, $params). class…
ESP32
  • 8,089
  • 2
  • 40
  • 61
2
votes
0 answers

Symfony3 - Cache component - Pool definition

I'ld like to use the new Symfony 3 Cache Component in a project. I can use it if I define my services by hand like this: app.cache.adapter.array: class: 'Symfony\Component\Cache\Adapter\ArrayAdapter' app.redis.client: class: Predis\Client …
Mait'
  • 98
  • 8
1
vote
2 answers

How to clear Twig cache fragments from Symfony?

I'm using the twig cache in a Symfony 5.4 project. If I cache something like: {% cache "customer_1" ttl(3600) tags('customer') %} Some HTML here {% endcache %} I need to be able to invalidate the twig cache with tag customer from within a Symfony…
fistameeny
  • 1,048
  • 2
  • 14
  • 27
1
vote
1 answer

How to set the key for a cache item with Symfony Cache?

I am trying to add caching to an existing Symfony project. But I am unsure how best to proceed I get an array with ids. I check every id if there is an item in the cache. If not, then break and send a query to the database. Then I'll get the result…
Ted Logan
  • 404
  • 1
  • 4
  • 15
1
vote
3 answers

Symfony 5 switch cache adapter on condition

I need to switch the Symfony cache adapter depending on ENV conditions. Like if some variable is set, use "cache.adapter.apcu" or use "cache.adapter.filesystem" otherwise. Is it possible somehow? The documentation is not really helpful with…
Gino Pane
  • 4,740
  • 5
  • 31
  • 46
1
vote
0 answers

Is it possible to avoid caching .env files by Symfony Cache?

I'm using Symfony 4, and I would like to know if is possible to avoid that Symfony Cache component cache my .env files in prod The main reason is that I'm trying to don't expose information saved there. I'm thinking right now to prevent it by adding…
yycub
  • 11
  • 1
1
vote
2 answers

Symfony on AWS EB - Unable to write in the cache directory after cache clear

I am deploying a Symfony 4.4 app to AWS ElasticBeanstalk and noticed that the cache wasn't cleared after each deploy. The app was running fine though, exception made to the stale cache. To resolve the cache issue I added the following…
BernardA
  • 1,391
  • 19
  • 48
1
vote
2 answers

Symfony Cache Component - Redis Adapter

I have implemented the Symfony Cache Component using RedisAdapter. Now we like to use a colon as separator in cache keys (e.g. some:cache:key:25). Just like Redis recommends. I get an Exception saying "contains reserved characters {}()/\@: etc.".…
fredtro
  • 63
  • 7
1
vote
1 answer

Symfony annotations directory very large in prod environment

I have a Symfony 2.8 project in the prod environment, but it 's too slow to clean the cache each time after code update. After i check the cache directory, i found that the annotation directory under app/cache/prod is very large and the code logic…
Yuliang Li
  • 417
  • 1
  • 5
  • 6
1
vote
1 answer

Symfony, Doctrine, Configuration and the Symfony Cache

I have a Symfony application that shares the same codebase for many DBs. It's quite typical, I have a single database for each "instance" (or "account") of my application, which is a simple medical appointments tool. I need to keep this architecture…
1
2