Class CommerceCacheKeyGenerator

java.lang.Object
de.hybris.platform.webservicescommons.cache.CacheKeyGenerator
de.hybris.platform.commercewebservicescommons.cache.CommerceCacheKeyGenerator
All Implemented Interfaces:
org.springframework.cache.interceptor.KeyGenerator

public class CommerceCacheKeyGenerator extends CacheKeyGenerator
Cache key generator
Spring Bean ID:
commerceCacheKeyGenerator
  • Constructor Details

    • CommerceCacheKeyGenerator

      public CommerceCacheKeyGenerator()
  • Method Details

    • generate

      public Object generate(boolean addUserToKey, boolean addCurrencyToKey, Object... params)
      Generates key based on given parameters and current session attributes ( base site, language, user, currency)
      Overrides:
      generate in class CacheKeyGenerator
      Parameters:
      addUserToKey - Define if current user uid should be added to key
      addCurrencyToKey - Define if current currency isocode should be added to key
      params - Values which should be added to key
      Returns:
      generated key
    • generateKey

      public static Object generateKey(boolean addUserToKey, boolean addCurrencyToKey, Object... params)
      Generates key based on given parameters and current session attributes ( base site, language, user, currency).
      It uses Registry.getApplicationContext().getBean to have access to instance of commerceCacheKeyGenerator.
      This static method was added because @Cacheable annotation doesn't support using bean in SPeL expression for key : https://jira.spring.io/browse/SPR-9578
      Parameters:
      addUserToKey - Define if current user uid should be added to key
      addCurrencyToKey - Define if current currency isocode should be added to key
      params - Values which should be added to key
      Returns:
      generated key
    • addCurrentSite

      protected void addCurrentSite(List<Object> key)
    • getBaseSiteService

      public BaseSiteService getBaseSiteService()
    • setBaseSiteService

      public void setBaseSiteService(BaseSiteService baseSiteService)