Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne.cache
Class MapQueryCache

    java.lang.Object
      org.apache.cayenne.cache.MapQueryCache

All Implemented Interfaces:
  Serializable, QueryCache

    public class MapQueryCache

extends Object
implements QueryCache, Serializable

A default implementation of the `QueryCache` interface that stores data in a non-expiring LRUMap.

Since:
  3.0
Author:
  Andrus Adamchik
See Also:
  Serialized Form

Field Summary
`static int` | `DEFAULT_CACHE_SIZE`
`protected Map<String,org.apache.cayenne.cache.MapQueryCache.CacheEntry>` | `map`

Constructor Summary
`MapQueryCache()`
`MapQueryCache(int maxSize)`

Method Summary
`void` | `clear()` Clears all entries.
`List` | `get(QueryMetadata metadata)` Returns a cached query result for the given QueryMetadata or null if the result is not cached or is expired.
`List` | `get(QueryMetadata metadata, QueryCacheEntryFactory factory)` Returns a non-null cached value.
`void` | `put(QueryMetadata metadata, List results)`
`void` | `remove(String key)` Removes a single entry from cache.
`void` | `removeGroup(String groupKey)` Removes a group of entries identified by group key.
`int` | `size()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_CACHE_SIZE

    public static final int DEFAULT_CACHE_SIZE

See Also:
  Constant Field Values

### map

    protected Map<String,org.apache.cayenne.cache.MapQueryCache.CacheEntry> map

Constructor Detail

### MapQueryCache

    public MapQueryCache()

### MapQueryCache

    public MapQueryCache(int maxSize)

Method Detail

### get

    public List get(QueryMetadata metadata)

  Description copied from interface: `QueryCache`
  Returns a cached query result for the given QueryMetadata or null if the result is not cached or is expired.

  Specified by:
    `get` in interface `QueryCache`

### get

    public List get(QueryMetadata metadata,
                    QueryCacheEntryFactory factory)

  Returns a non-null cached value. If it is not present in the cache, it is obtained by calling `QueryCacheEntryFactory.createObject()` without blocking the cache. As a result there is a potential of multiple threads to be updating cache in parallel - this wouldn't lead to corruption of the cache, but can be suboptimal.

  Specified by:
    `get` in interface `QueryCache`

### put

    public void put(QueryMetadata metadata,
                    List results)

  Specified by:
    `put` in interface `QueryCache`

### remove

    public void remove(String key)

  Description copied from interface: `QueryCache`
  Removes a single entry from cache.

  Specified by:
    `remove` in interface `QueryCache`

### removeGroup

    public void removeGroup(String groupKey)

  Description copied from interface: `QueryCache`
  Removes a group of entries identified by group key. This may not be supported by the implementation.

  Specified by:
    `removeGroup` in interface `QueryCache`

### clear

    public void clear()

  Description copied from interface: `QueryCache`
  Clears all entries.

  Specified by:
    `clear` in interface `QueryCache`

### size

    public int size()

  Specified by:
    `size` in interface `QueryCache`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2008 Apache Cayenne. All Rights Reserved.