• Post Reply Bookmark Topic Watch Topic
  • New Topic

How does a cache holds a record set  RSS feed

 
Mike Cheung
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, most caches including EhCache works like a Java map (ie key value pair). But it's typically used to cache database records which are returned as a row with multiple columns.
So how does it work? The key for the cache is holding the rowname, and the value is holding say an array which contains all the columns? Or for each row you have an array of these key-value pair, where the keys are the column names and the values are the cell values?
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Either approach is possible, and I'm sure one could come up with yet more designs. What is most suitable depends on the circumstances. Does it matter how it's done, as long as it works? (Which is my snarky way of asking: "What prompted this question?" :-)
 
Mike Cheung
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay and is that how it's typically used? The reason I'm asking is because it seems to be a rather non straight forward way of storing results returned from a database. If it's like that why don't I use a vector of vector instead?
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!