roadrunner-bundle icon indicating copy to clipboard operation
roadrunner-bundle copied to clipboard

Shared cache between workers

Open skekec1 opened this issue 4 years ago • 4 comments

Hi everyone,

i have a question about Roadrunner and symfony and its behaviour regarding caching:

We are currently using symfony with two caching adapters in this order: array,redis

We noticed that this causes some problems and we get out-dated values from the cache. Are we right with our assumption that this is caused by none shared caches on the array level, so that all workers accessing their own representation and values?

If this is the case:

  • Can APCu solve this problem?
  • Are there other ways to solve this problem? What are you doing to solve this?

Thanks in advance!

Selcuk

skekec1 avatar Apr 06 '21 15:04 skekec1

Hi! Thanks for using this bundle :)

I am not aware of a way to share memory between php cli scripts.

If you can afford some out dated data, I would recommend to simply reduce the expiration time of your items.

Otherwise you will be required to rely only on redis.

Maybe it's possible to setup something to keep data in array but invalidate via tags stored in redis, with https://symfony.com/doc/current/components/cache/cache_invalidation.html#tag-aware-adapters

[Edit]

It seems that something is already there on the RoadRunner side: https://github.com/spiral/roadrunner/tree/master/plugins/kv

I have no time to work on this for now, but I would be happy to merge a PR :)

Baldinof avatar Apr 06 '21 17:04 Baldinof

Hey, RR has new KV plug-in and SDK for it. You can use it for caching. :)

wolfy-j avatar Jul 08 '21 07:07 wolfy-j

Yeah, I will find time to integrate it with Symfony :)

Baldinof avatar Jul 08 '21 07:07 Baldinof

@Baldinof I see that this hasn't been done yet, I created a PR for this: https://github.com/Baldinof/roadrunner-bundle/pull/137

StanJansen avatar Feb 16 '24 10:02 StanJansen