[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Understanding the CacheInterceptor

Our application require some ultra-fast lookups on a unique index other than the primary key. There are some posts and notes on the web indicating that cache indexes might be coming at some point, but in the meantime we actually have to go with a home grown solution. So the current thinking has two pieces:

 

1) To manage the index we create a CacheInterceptor, and intercept cache operations. Whenever an object (of the required class) is inserted or updated into the cache, we extract the other index and create a simple Map of {index,object}.

 

2) To read objects, we create a Redirect Query which reads the map.

 

So, two questions, really:

 

- Does this make sense?

- Is there any sample code out there using the CacheInterceptor?

 

Eirik