Skip to content

FastAPI Tutorial: Give some more background on Redis #22308

Closed
@aeschli

Description

@aeschli

Testing #22302

I'm looking at the 'Replace the database' section. I'm new to Redis.

It explains nicely what line I need to replace with what, but I'm puzzled of what the new code means and how redis works.

redis_client.hincrby(f"item_id:{item_id}", "quantity", quantity)

what does this call do? What is hincrby. What's the effect to the database?

Maybe it is easier to start with the set:

redis_client.hset(
            f"item_id:{item_id}",
            mapping={
                "item_id": item_id,
                "item_name": item_name,
                "quantity": quantity,
            })

This seems to store an object with multiple properties. And hincrby allows to increment one of the properties?

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugdocumentationtriage-neededNeeds assignment to the proper sub-teamverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions