Behavior Summary
The Jasig community would like to add "prefetching" capabilities to the News Reader Portlet. This new feature should allow some sub-set of pre-defined feeds to be regularly pulled and cached on the server so that no individual user should experience a fetching delay while attempting to view that feed. End users should not be allowed to create prefetched feeds to prevent performance problems from overusage or poorly behaving feeds. Feeds should only be prefetched when they are eligible for caching between users. If a feed is unavailable for a period of time, the code should continue to use the latest valid copy.
Proposed Changes
The existing INewsAdapter requires access to the PortletRequest while retrieving news feeds. A prefetching implementation would need to be able to request feeds without access to a specific PortletRequest object.
AntiSamy Configuration
- Set default AntiSamy policy in configuration.properties
- Override on a feed-specific basis in an adapter property
New IPrefetchableNewsAdapter API
INewsAdapter
getSyndFeed(NewsConfiguration config, PortletRequest request)
IPrefetchableNewsAdapter extends INewsAdapter
getSyndFeed(NewsDefinition def)
parameters
- prefetching enabled/disabled
- fetch frequency
Caching and Prefetching Implementation
- Query database for registered feeds with prefetching enabled
- Use Quartz/Spring Timer to regularly fetch feeds. Upon successful fetch, update cache
- Caching via ehcache configured such that feed should only be fetched by timer job.