Steps to follow:
- Choose the option number from the list
- Enter the id/timing as integer values.
- To check for restaurants enter the time you want to select.
NOTE: Before checking for restaurants at a specific time, please update the cache for that time as a continous service is not running for updating the cache. Enter all values as int only.
Sample Output:
What would you like to do
- Enter new restaurant
- Enter holiday timings
- Check restaurants for current time
- Update cache for the given time
- Exit choose -1 1 Enter the restaurant id as int 1 Please enter the timings of the restaurant Enter the number of timing values 2 Enter the opening time 1 Enter the closing time 7 Enter the opening time 13 Enter the closing time 17 What would you like to do
- Enter new restaurant
- Enter holiday timings
- Check restaurants for current time
- Update cache for the given time
- Exit choose -1 4 Enter the time for which cache should be updated 1 Updating the cache for current time period Cache updated What would you like to do
- Enter new restaurant
- Enter holiday timings
- Check restaurants for current time
- Update cache for the given time
- Exit choose -1 3 Enter the current time 3 Restaurant 1 open What would you like to do
- Enter new restaurant
- Enter holiday timings
- Check restaurants for current time
- Update cache for the given time
- Exit choose -1 2 Enter the restaurant id as int 1 Please enter the timings of the restaurant Enter the start time 3 Enter the end time 4 What would you like to do
- Enter new restaurant
- Enter holiday timings
- Check restaurants for current time
- Update cache for the given time
- Exit choose -1 4 Enter the time for which cache should be updated 3 Updating the cache for current time period Cache updated What would you like to do
- Enter new restaurant
- Enter holiday timings
- Check restaurants for current time
- Update cache for the given time
- Exit choose -1 3 Enter the current time 3 Restaurant 1 closed will open at 4
For Scale (Not 100% sure this is the optimal way to do it): We can run a periodic service/cron jobs that just updates the cache at that interval or we can have a lambda function trigger a cache update whenever the time is the same as the starttime of updateState. For caching we can use a redis cache.