I want to cache the content in a DB table like below, on the Java heap of an JavaEE application server.
| group | key | value |
| ------- | ------- | -------------------------------------- |
| CHAR(3) | CHAR(5) | VARCHAR(256) |
| ------- | ------- | -------------------------------------- |
| 001 | 0 | male |
| 001 | 1 | female |
| 001 | 9 | other |
| 002 | 004 | Afghanistan |
| 002 | 008 | Albania |
| 002 | 010 | Antarctica |
| 002 | 012 | Algeria |
| ... | ... | ... |
| 003 | LAX | Los Angeles International Airport |
| 003 | SIN | Singapore Changi International Airport |
| ... | ... | ... |
I think the JCache is most general way for those purposes, but how can I save the order of these records in the cache, like LinkedHashMap?
(The configuration for specific JCache implementation is acceptable.)
EDIT
This is a typical One True Lookup Table (OTLT) in the legacy enterprise application now I am working on. The primary sort key is group
, and secondary sort key is key
.
OTLT has some disadvantages in performance, so I want to use use cache mechanism as a countermeasure to this disadvantages.