I'm developing a web application for medical purposes, where the users can create an appointment for a specific patient, doctor and facility. Each facility may have N doctors, and the calendar will be populated with N appointments per doctor and will also show the availabilites of each doctor (ex.: Doctor Who works on wednesday from 9:00 to 12:00 and from 15:00 to 18:00).
For the front-end part I'm using fullcalendar and the backend is made using Struts2 (controllers) + Spring (dependency injection) + Hibernate (DAO).
Since a user (usually) has to load the appointments from this week to a month or two in the future, and there may be from one to N users for each facility that will use this view for a long time, I'd like to cache the appointments + availabilities using Redis and I've added to my project the Spring data redis with Lettuce client. The idea is to use the @Cacheable
, @CachePut
and @CacheEvict
annotations for the DAO's methods, handling the users action like list, create and update the appointments avoiding conflicts between the redis data and the database data and other concurrency problems.
My questions are:
- Is this the correct strategy?
- Should I implement a custom key generator in order to cache the appointments besed on the facility + doctor ids?