I have following scenario (modified one than actual business purpose).
- I have a program which predicts how much calories a person will loose for the next 13 weeks based on certain attributes.
- I want to cache this result in the database so that i don't call the prediction again for the same combination.
- I have class person
class Person { int personId; String weekStartDate; }
- I have
HashMap<List<Person>, Integer>
- The key is 13 weeks data of a person and the value is the prediction - I will keep the hashvalue in the database for caching purpose
Is there a better way to handle above scenario? Any design pattern to support such scenarios
, Integer> - The key is 13 weeks data of a person and the value is the prediction ---> The person objects are not really data right? Since they only contain personIds and dates?
– Stefan Apr 06 '18 at 13:08