uPortal-Project/NewsReaderPortlet

Add caching to database calls

Opened this issue · 3 comments

bjagg commented

Problem:
There is no caching for database calls. News Reader data is ideal with few updates and lots of reads.

Solution:
Add caching to HibernateNewsStore.java for the following:

  • NewsConfiguration (x3)
  • NewsSet
  • NewsDefinition (x3)

There are several getters and the classes form a heirarchy: configuration > set > definition.

Some time will be needed to sort the caching strategy.

bjagg commented

Method review:

  1. storeNewsDefinition: all caches flushed
  2. storeNewsConfiguration: all caches flushed
  3. getNewsConfigurations: cache<subscribeId, list NewsConfiguration>
  4. getUserDefinedNewsConfiguration: cache<(setId,visibleOnly), list UserDefinedNewsConfiguration>
  5. getPredefinedNewsConfigurations: cache<(setId,visibleOnly), list PredefinedNewsConfiguration>
  6. getPredefinedNewsConfigurations: cache<(setId=-1,visibleOnly = false), list PredefinedNewsConfiguration>
  7. getHiddenPredefinedNewsDefinitions: cache<(setId, roles), list PredefinedNewsConfiguration>
  8. initNews: all caches flushed
  9. ...
bjagg commented

Also cache NEWS_PARAMETER table

bjagg commented

Spring dependencies already included.

Caching manager already defined: https://github.com/uPortal-Project/NewsReaderPortlet/blob/master/src/main/resources/context/applicationContext.xml#L40

Need to add cache annotation scan tag to application context still.