Class CachedMapFacade<V extends Cacheable>

  • All Implemented Interfaces:
    Store<V>, Map<Identifier,​V>

    public abstract class CachedMapFacade<V extends Cacheable>
    extends Object
    implements Store<V>
    A Facade for a map that is backed by a cache. Since all stores are logically maps as well, this can be used to cache any store.
    Note: This persists immediately on put, so there are lazy reads but not writes. Gets to this are checked against the cache. If found, then that is returned, if not, the store is checked. Invoking put will either add a new item to the store or over-write an existing one with the same identifier. There is consequently a save operation implied with it.

    Usage

    Extend this to the correct parameters. Implement any interfaces you need for storage then set the backing store to be your real store and use this class everyplace you would normally have your store.

    This will remove from the store immediately as well.

    Created by Jeff Gaynor
    on Nov 12, 2010 at 11:31:47 AM