Este contenido no está disponible en el idioma seleccionado.
6.4.2. Adding and Replacing a Key Value
JBoss Data Grid offers a thread-safe data structure.
The following procedure is an example that defines what each line entered into the
DefaultCacheQuickstart.java file does:
Procedure 6.3. Adding and Replacing a Key Value
- Add an entry with
keyas the key value.cache.put("key", "value");cache.put("key", "value");Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Check if the key value is missing. If the value is not found, replace the absent value with
key. If the value is found, no change occurs.cache.putIfAbsent("key", "newValue");cache.putIfAbsent("key", "newValue");Copy to Clipboard Copied! Toggle word wrap Toggle overflow