Get all values of a type from Redis
Hi,
I need to read all merchants from the Redis in performant way.
I tried to use \Spryker\Client\Storage\StorageClientInterface::getKeys
with kv:merchant:*
wildcard , but it is blocking Redis, so whole system slows down.
I tried \Spryker\Client\Storage\StorageClientInterface::scanKeys
as well, but it's too slow in big redis set.
Does the Spryker have any solution for that? Predis
lib supports hash
methods ( HSET
, HGET
, etc), but i don't see them in Spryker's wrapper of Predis
.
Do you know any better or other solution to read all values of key subset (all merchants) from redis?
Best Answers
-
fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,056 ⚖️ - Guardians (admin)
Heyhey,
did you find a solution yet?
If it works with the has methods you could expose them by overriding the RedisClient/RedisAdapter →vendor/spryker/redis/src/Spryker/Client/Redis/Adapter/PredisAdapter.php
Also I saw that some redis methods (even within Spryker) offer pagination. Maybe this could also be a way to go.
All the best,
Florian
0 -
fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,056 ⚖️ - Guardians (admin)
Hello @przemyslaw.szychowski ,
ahh ok. No, sadly there is no OOTB solution I could find.
All the best,
Florian
0
Answers
-
Why do u need to read all merchants from Redis?
0 -
Merchants collection is just an example. We have such business case, which has to be fullfilled.
At some cases it may be better to use ES for example, but we have a case, where we have a few dozen values of one type in Redis and easiest would be to just read them all at once instead of introducing ES or custom solution for that.
0 -
fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,056 ⚖️ - Guardians (admin)
Heyhey,
did you find a solution yet?
If it works with the has methods you could expose them by overriding the RedisClient/RedisAdapter →vendor/spryker/redis/src/Spryker/Client/Redis/Adapter/PredisAdapter.php
Also I saw that some redis methods (even within Spryker) offer pagination. Maybe this could also be a way to go.
All the best,
Florian
0 -
Hello @fsmeier,
thank you for responding my question.
I know that these methods exist there and can be exposed, but this means extending a lot of Spryker's classes 😅
I hoped there is some OOTB solution.
0 -
fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,056 ⚖️ - Guardians (admin)
Hello @przemyslaw.szychowski ,
ahh ok. No, sadly there is no OOTB solution I could find.
All the best,
Florian
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 69 Spryker News
- 896 Developer Corner
- 758 Spryker Development
- 83 Spryker Dev Environment
- 361 Spryker Releases
- 3 Oryx frontend framework
- 34 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 23 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