Currently, I have 2 DAOs for creating DayActivity
objects:
- one getting the objects from the local hard drive (cached between sessions)
- one getting the objects from a remote database
I am limited to the number of calls I can make to the database and the size limitation for each query, hence relying on a cache between sessions. I have kept the code for each of these DAO separate, since they each are getting the information from separate locations.
What I want to do now is create a DAO(would it be?) for getting a range of DayActivities
, where some of them are cached and some are from the remote, depending on some conditions.
- Is it common for a "DAO" to use mix sources (I would have thought not because then it would mean combining the logic for each)?
- Should I just be putting the logic to decide where the data is coming from elsewhere without thinking of a particular pattern? (I wouldn't have thought this would be the situation since this relies on the rest of the code knowing the actual implementation of the storage)
- Should I be using another design pattern instead?
- Or, is there another option I haven't considered?
Aucun commentaire:
Enregistrer un commentaire