com.github.jknack.handlebars.cache
Class ConcurrentMapCache

java.lang.Object
  extended by com.github.jknack.handlebars.cache.ConcurrentMapCache
All Implemented Interfaces:
TemplateCache

public class ConcurrentMapCache
extends Object
implements TemplateCache

A TemplateCache based on a ConcurrentMap.

Since:
0.1.0
Author:
edgar.espina

Constructor Summary
ConcurrentMapCache()
           
 
Method Summary
 void clear()
          Remove all mappings from the cache.
 void evict(Object key)
          Evict the mapping for this key from this cache if it is present.
 Template get(Object key)
          Return the value to which this cache maps the specified key.
 void put(Object key, Template template)
          Associate the specified value with the specified key in this cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConcurrentMapCache

public ConcurrentMapCache()
Method Detail

clear

public void clear()
Description copied from interface: TemplateCache
Remove all mappings from the cache.

Specified by:
clear in interface TemplateCache

evict

public void evict(Object key)
Description copied from interface: TemplateCache
Evict the mapping for this key from this cache if it is present.

Specified by:
evict in interface TemplateCache
Parameters:
key - the key whose mapping is to be removed from the cache

get

public Template get(Object key)
Description copied from interface: TemplateCache
Return the value to which this cache maps the specified key. Returns null if the cache contains no mapping for this key.

Specified by:
get in interface TemplateCache
Parameters:
key - key whose associated value is to be returned.
Returns:
the value to which this cache maps the specified key, or null if the cache contains no mapping for this key

put

public void put(Object key,
                Template template)
Description copied from interface: TemplateCache
Associate the specified value with the specified key in this cache.

If the cache previously contained a mapping for this key, the old value is replaced by the specified value.

Specified by:
put in interface TemplateCache
Parameters:
key - the key with which the specified value is to be associated
template - the value to be associated with the specified key


Copyright © 2012. All Rights Reserved.