org.mmbase.applications.media.cache
Class URLCache

java.lang.Object
  extended by org.mmbase.cache.Cache<String,String>
      extended by org.mmbase.applications.media.cache.URLCache
All Implemented Interfaces:
Map<String,String>, CacheMBean, SizeMeasurable

public class URLCache
extends Cache<String,String>

A cache for URLS requested in the MediaFragment builder. This cache can easily be extended in such a way it can cache more requests.

Author:
Rob Vermeulen (VPRO), Michiel Meeuwissen

Nested Class Summary
(package private)  class URLCache.CacheExpire
          Contains information about which objects are used to create a certain cache entry.
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
 
Fields inherited from class org.mmbase.cache.Cache
lock, maxEntrySize
 
Method Summary
 void clear()
           
static URLCache getCache()
           
 String getDescription()
          Gives a description for this cache type.
 String getName()
          Returns a name for this cache type.
 void nodeChange(String nodeNumber)
          Invalidates cache entries based on the node that changes
 void put(String key, String result, Set<MMObjectNode> objects)
          put an entry in the cache
static String toKey(MMObjectNode mediaFragment, Map<String,Object> info)
          creates a key based of the media fragment number and the user information
 
Methods inherited from class org.mmbase.cache.Cache
checkCachePolicy, contains, containsKey, containsValue, entrySet, equals, get, getAvarageValueLength, getByteSize, getByteSize, getCheapByteSize, getCount, getDefaultMaxEntrySize, getHits, getImplementation, getLock, getMaxEntrySize, getMaxSize, getMisses, getPuts, getRatio, getSize, getStats, hashCode, isActive, isEmpty, keySet, maxSize, put, putAll, putCache, remove, reset, setActive, setMaxEntrySize, setMaxSize, size, toString, values
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getCache

public static URLCache getCache()

toKey

public static String toKey(MMObjectNode mediaFragment,
                           Map<String,Object> info)
creates a key based of the media fragment number and the user information

Parameters:
mediaFragment - fragment to be cached
info - user information to be cached
Returns:
key to be cached

put

public void put(String key,
                String result,
                Set<MMObjectNode> objects)
put an entry in the cache

Parameters:
key - cache key
result - cache result
objects - the objects that can invalidate the cache

clear

public void clear()
Specified by:
clear in interface Map<String,String>
Specified by:
clear in interface CacheMBean
Overrides:
clear in class Cache<String,String>
See Also:
Map.clear()

nodeChange

public void nodeChange(String nodeNumber)
Invalidates cache entries based on the node that changes

Parameters:
nodeNumber - number of node that changes

getName

public String getName()
Description copied from class: Cache
Returns a name for this cache type. Default it is the class name, but this normally will be overriden.

Specified by:
getName in interface CacheMBean
Overrides:
getName in class Cache<String,String>

getDescription

public String getDescription()
Description copied from class: Cache
Gives a description for this cache type. This can be used in cache overviews.

Specified by:
getDescription in interface CacheMBean
Overrides:
getDescription in class Cache<String,String>


MMBase 2.0-SNAPSHOT - null