Este contenido no está disponible en el idioma seleccionado.
1.4. Placing and Retrieving Sets of Data
The
AdvancedCache and RemoteCache interfaces include methods to either put or get a Map of existing data in bulk. These operations are typically much more efficient than an equivalent sequence of individual operations, especially when using them in server-client mode, as a single network operation occurs as opposed to multiple transactions.
When using the bulk operations the memory overhead is higher during the operation itself, as the
get or put operation must accommodate for the full Map in a single execution.
The methods for each class are found below:
AdvancedCache:Map<K,V>getAll(Set<?> keys)- returns aMapcontaining the values associated with the set of keys requested.- void
putAll(Map<? extends K, ? extends V> map, Metadata metadata)- copies all of the mappings from the specified map to this cache, which takes an instance ofMetadatato provide metadata information such as the lifespan, version, etc. on the entries being stored.
RemoteCache:Map<K,V>getAll(Set<? extends K> keys)- returns aMapcontaining the values associated with the set of keys requested.- void
putAll(Map<? extends K, ? extends V> map)- copies all of the mappings from the specified map to this cache. - void
putAll(Map<? extends K, ? extends V> map, long lifespan, TimeUnit unit)- copies all of the mappings from the specified map to this cache, along with a lifespan before the entry is expired. - void
putAll(Map<? extends K, ? extends V> map, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)- copies all of the mappings from the specified map to this cache, along with both a timespan before the entries are expired and the maximum amount of time the entry is allowed to be idle before it is considered to be expired.