Solution: Reservation Queue
Here's the solution to the reservation queue challenge.
We'll cover the following...
We'll cover the following...
Solution
Let’s discuss the solution for implementing a book reservation queue.
Update the Book class
First, we add the Boolean available property to the Book class.
Create the User class
Then, we create the User class in the com.smartdiscover.model package.
Here’s an explanation of the code:
-
Lines 7–9: We add annotations like
@Dataand@RedisHashto transform a class into a Redis hash. -
Line 11: We add the
ididentifier. -
Lines 13 and 14: We add the
firstNameproperty with the@Indexedannotation to let Redis index the property values. -
Lines 16 and 17: We add the
lastNameproperty with the@Indexedannotation. ...