Bug in generating keys for Redis.
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
-
fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,052 ⚖️ - Guardians (admin)
Heyhey @filip.gojkovic955 ,
for me it sounds reasonable what you write there - yet I have not validated it by myself.
The best would be if you file a bug-report through the official support portal so the team can take it to further investigations :)
All the best,
Florian
0 -
I got same things
I tried use \Spryker\Client\ProductStorage\ProductStorageClient::findProductAbstractStorageDataByMapping
example:
$this->getFactory() ->getProductStorageClient() ->findProductAbstractStorageDataByMapping('sku', $itemTransfer→getSku(), 'en_US')
expected:
the response show me the product abstract data
actually:
the response is null
##############
I found the redis storage saved the data look like this
But actually the key generated was be set is: product_abstract:de:en_us:sku:115_21811723
So I think the response will be null if we try to get data with the function findProductAbstractStorageDataByMapping
1 -
@Alberto Reyer can you help for verify this issues ?
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 68 Spryker News
- 890 Developer Corner
- 753 Spryker Development
- 83 Spryker Dev Environment
- 360 Spryker Releases
- 3 Oryx frontend framework
- 34 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 22 Job Opportunities
- 3.2K 📜 Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 68 Spryker Safari Questions
- 50 Random