Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Comments on How can I get a value as a node:stream from the Nest.js cache-manager?

Post

How can I get a value as a node:stream from the Nest.js cache-manager?

+2
−0

Question

How can I read data from a NestJS Redis Cache as a stream?

I'm using Nest.js and its @nestjs/cache-manager (using the Redis implementation), I need to read data I have stored in the cache as a stream, but I'm not entirely sure how to go about it. I can't find much of a hint in the type deceleration file for cache-manager. Has anyone done anything like this?

Context

I have some large data split into pages amongst multiple keys (there is lots of data), and I want to stream multiple of the pages into a pipeline that further filters all that data to a much smaller data set.

The base query that populates the data was rather complex and time intensive to run, so hence I am caching it to not have to run that query again (frequently accessed data), but now I have a problem where there are 1.6 million records in one cache-key, and it's a memory bottleneck. So I figured streaming was in order, and I'm planning to split that large chunk of data up into many smaller pages I will place in the cache, but if I need to filter all of them again I want to filter them in a stream/pipeline.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

Can the the 1.6 million records be stored in the database? (2 comments)
Can the the 1.6 million records be stored in the database?
Alexei‭ wrote about 1 year ago

Caching is typically used for storing reasonably small pieces of data. Is there any reason not to store the computed result in the database and use the streaming capabilities most database connectors offer to do your processing?

gdfelt‭ wrote about 1 year ago

I would like too, but the database is being shared between a legacy system and my project, and it may be quite the hassle to add a new table. I'm actively brainstorming how to use the database effectively though.

Skipping 1 deleted comment.