Inhalte aufrufen

Profilbild

OutputCache Customize CacheKey

loginsystem shop log

  • Bitte melden Sie sich an, um eine Antwort zu verfassen.
2 Antworten zu diesem Thema

#1 netroskop

netroskop

    Member

  • Members
  • PunktPunkt
  • 20 Beiträge

Geschrieben: 23 January 2023 - 11:47

Hello,
 
 
In a module I developed, I override product prices according to certain values ​​of the user.
 
But when I activate the output cache module, all users see the same special price. Because output cache route key is same.
 
Is it possible to keep the user values ​​that I developed with a different querystring in OutputCache?

  • stefanmueller gefällt das

#2 Michael Herzog

Michael Herzog

    SmartStore AG

  • Administrators
  • 3498 Beiträge

Geschrieben: 30 January 2023 - 20:19

Hi,

 

I assume you are working with Smartstore 5?
 
First I need to know how you display the price.
Have you built a ViewComponent or your own PriceCalculator? 
Or do you manipulate the model by filter? Or have you overwritten the PriceCalculationServie?
 
Because of the problem described, I'm assuming a ViewComponent.
Actually, this should not be cached by default unless you have registered a CachableRoute. 
 
We have changed some of the code for the output cache in the last few days, as we have also noticed a problem here.
Can you still reproduce the problem with the current code from Branch 5.x?
 
Regards,
Michael
 

  • netroskop gefällt das

Michael Herzog
Smartstore AG


#3 netroskop

netroskop

    Member

  • Members
  • PunktPunkt
  • 20 Beiträge

Geschrieben: 31 January 2023 - 06:50

Hello Mr. Herzog. Yes I am working with v5. We show price by overriding some methods of PriceCalculationServie.

 

But for example, while X product is 5€ on the homepage for customer A, it should be 7€ for customer B.

 

However, everyone sees the price of the product as 5€, as the 5€ that appears for customer A who first visits the page is cached.

 

On the other hand, we want to cache the relevant routing in terms of performance. But for this route, the existing
- c(currency)
- s(storeId)
- l(languageId)
If we add an additional variable to fields such as, we can create a special cache only for that customer. What I want to know is whether this is possible.


  • stefanmueller und Fred Jie gefällt das