0

I am fairly new when it comes to designing a system to carry data though multiple layers from backend to frontend.

Currently I have a class which when run, will immediately run a query on a date range of data and write it to a file. I am in the process of setting up a 'middleman' to access bits and pieces of my data and in turn send the data as a json object to the front end code.

Where I am getting held up is with my original code which handles the queries. I want to in a sense cache or hold onto a single instance of my lump data so that other higher level classes can call accessor methods on the parts of my data I want without multiple queries to the server needing to be made.

This might be too much of a high level design pattern question to answer without much detail, but any advice or pushes in the right direction for further research would be appreciated.

1
  • This might be useful: stackoverflow.com/questions/13158657/…. You also might want to use something like memcache or redis to hold this data along with a lastModified timestamp so you can expire cache entries to keep the data reasonably fresh if that's a concern of yours. Nov 7, 2013 at 13:54

1 Answer 1

0

If you designing a system to currying data to the different layer then you'd better look at the DAO/DTO pattern. Working with data means creating a data model which would hold the data and map that model to the persistence layer. Whatever you use file or database to which you should create the datasource. Consider looking at the JPA that is well suited for the persistence layer. it also includes a L2 cache support with the persistence provider.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.