• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

How does a cache holds a record set  RSS feed

 
Ranch Hand
Posts: 115
  • 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?
 
Rancher
Posts: 42974
76
  • 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: 115
  • 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?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!