|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.kuali.rice.core.api.cache.CacheKeyUtils
public final class CacheKeyUtils
A utility class that can be used to generate cache keys for more complex method signatures. Currently, the utilities on this class focus on generating cache keys for collections of objects. Since the caching infrastructure only supports a single @{code String} value as a key for cache entries, this utility helps to provide a standard way to generate such compound caching keys.
It is possible to use this utility class when specifying keys for cached objects using Spring's caching abstraction (which is what the Rice caching infrastructure is built on). This is possible using the Spring Expression Language (SPEL). An example might look something like the following:
@Cacheable(value = "StuffCache", key="'ids=' + T(org.kuali.rice.core.api.cache.CacheKeyUtils).key(#p0)")
List<Stuff> getStuff(List<String> stuffIds);
Method Summary | ||
---|---|---|
static
|
key(Collection<K> col)
Create a String key value out of a Collection. |
|
static
|
mapKey(Map<K,?> col)
Create a String key value out of a Map. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <K extends Comparable<K>> String key(Collection<K> col)
.toString()
values of each item in the sorted collection.
The sorting of the given list happens on a copy of the list, so this method does not side-affect the given list.
K
- the col typecol
- the collection. if null will return "", if empty, will return "[]"
public static <K extends Comparable<K>> String mapKey(Map<K,?> col)
.toString()
values of each item in the sorted collection.
The sorting of the given map happens on a copy of the map, so this method does not side-affect the given map.
K
- the col typecol
- the map. if null will return "", if empty, will return "[]"
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |