Bug in generating keys for Redis.

filip.gojkovic955
filip.gojkovic955 Spryker Solution Partner Posts: 19 ✨ - Novice
edited October 2023 in Spryker Dev Environment

Hi I'm working on implmentation of FactFinder in spryker system.

I found out that sku that gets returned from FactFinder is used to generate redis key. With that redis key we are querying redis to get the data.

Method in ProductAbstractStorageReader class(vendor/spryker/product-storage/src/Spryker/Client/ProductStorage/Storage/ProductAbstractStorageReader.php) called "findProductAbstractStorageDataByMapping".

That method is called in my case fro 10 places:

As picture suggest those are all bridges from some glue API. Method has first parameter "MAPPING TYPE".

If I go to see what value does $mappingType have it is always "sku"


The method "findProductAbstractStorageDataByMapping" generates $reference

$reference = $mappingType . ':' . $identifier;

Identifier is SKU of product. Let's take some sku. For example i have sku "M100000068" for one abstract product.

$reference = "sku" . ":" . "M100000068";
So result is "sku:M100000068"

Key generation in redis has some rules and are defined in xml file.

Key is build like:
resource, store, locale, key_suffix_column
Example: product_abstract:de:de_de:515


Since glue apis and FactFinder are concatenating reference as "sku" . ":" . "[sku_number]" that reference would never match any of the keys in redis since keys in redis have different logic of generation.

When i call FactFinder or any GLUE apis that were mentioned in bridges in picture above.
They will generate key like:
"product_abstract:de:de_de:sku:sku:M100000068"

And all keys in redis will look like.
product_abstract:de:de_de:515

All of that being said. I can not see a way for this to work. Is this a known bug? Or am I missing something?

Comments

This discussion has been closed.