gecche / laravel-multidomain

A Laravel extension for using a laravel application on a multi domain setting
MIT License
838 stars 105 forks source link

How can i retrieve cache variable from multi-domain #94

Open devpaulopaixao opened 1 year ago

devpaulopaixao commented 1 year ago

I have two domains, they are admin.site.com.br and user.site.com.br. I need to get from cache the variable user-is-online concatenated with auth user id. But, this just works for the first domain, not for the second when use cache()->get('user-is-online' . auth()->user()->id). Any solution?

gecche commented 1 year ago

Hi,

I need some more info for trying to help you, but I don't think that the problem is the concatenation. Which version of the package do you use? Which driver do you use for the cache?

Cheers

Giacomo

devpaulopaixao commented 1 year ago

At the moment, i use version 4.0 with default cache driver(file).

gecche commented 1 year ago

I will try to do some test asap... however your problem sounds a bit strange because using the standard file driver, the cache files should be completely separated and it always worked for me. You should have in your folder structure storage/admin.site.com.br/framework/cache and storage/user.site.com.br/framework/cache Can you check you have this structure? Second question: could you share more about the code where you are retrieving the cache variable? Are you using it in a job/commnad or via web?