I'm working on some task-based software, and want to maintain views of
the tasks for easy querying - enter Glazed Lists.
The problem I'm facing:
- Task lists are relatively transient (e.g. once complete, they are
only retained for auditing/reporting purposes)
- The persistence layer is pluggable (might be a
database/hibernate, but currently is a different type of store)
- The current implementation is a cache of tasks by id, and run an
arbitrarily complex query to determine what id's should be returned
(tasks link to other information via universal identifiers, so building
a task object may query multiple systems)
So, I need to:
- Lazily build the backing list by the view requests
- Update the backing list as appropriate for the requested views
- Automatically dispose list views via same sort of cache-like
algorithm
1 and 2 I'm thinking will already be supplied, or easily possible, but
the last... is this something I'd need to write myself?
Is this the right thing:
- Have an CachedEventList that is essentially a cached list
(something that will indicate when something is being removed due to
cache expiry/size constraints)
- ... referenced by a ListViewCache where lists can be retrieved by
matchers:
- If it exists, then return the list view
- otherwise, Request it from the CachedEventList, which will
ensure full population
- If the CachedEventList purges a task (expiry/size constraints),
the ListViewCache (as a listener of the CachedEventList) will dispose
the appropriate views. A brute force implementation could iterate
through all the ListViewCache's keyed matchers to see if they match the
purged task...
Has this been done before? Is it the right direction to head in?
Thanks heaps for an awesome idea/implementation...
Stephen