public final class CacheKeyUtils extends Object
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);
Modifier and Type | Method and Description |
---|---|
static <K extends Comparable<K>> |
key(Collection<K> col)
Create a String key value out of a Collection.
|
static <K extends Comparable<K>> |
mapKey(Map<K,?> col)
Create a String key value out of a Map.
|
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 "[]"Copyright © 2005–2015 The Kuali Foundation. All rights reserved.