I'm not wholly comfortable with Spring AOP yet and was hoping someone might point me to the simplest way of doing the following, which strikes me as a likely candidate for the benefits of AOP.
I'm working on a web application which has lots of different business objects, and in very many cases there is a need to provide popups of, say, all countries when adding/editing organisations, that kind of thing. That is, a collection of any object might be used as a choice list for any other object. Now, obviously if we do a select from the database every time, this will bring the system to its knees. Yet if we use a cache, we have to be certain that nothing has changed in the source data since we populated the cache.
What I would like to do is to intercept all method calls of 'storeXXX' and 'deleteXXX' in the DAO layer and update a row in the db to indicate that, e.g., the countries data was last modified at this time. Similarly, I would like to intercept all calls to 'listXXX' (the methods which will give me the choice lists), check in a cache (maybe EHCache, maybe a simple LinkedHashMap) to get the timestamp of this cache copy, look in the database to see if the sata has been modified since, and if it has, refresh the cache, otherwise use the cache entry.
I appreciate that the Wanghey cache does something not a million miles away, but I want something really simple for this. Any pointers as to what interfaces I need to implement?