Local maps can be used to share data safely in a single Vert.x instance.
By default the map allows immutable keys and values. Custom keys and values should implement \io\vertx\jphp\core\shareddata\io.vertx.core.shareddata.Shareable interface. The map returns their copies.
This ensures there is no shared access to mutable state from different threads (e.g. different event loops) in the Vert.x instance, and means you don't have to protect access to that state using synchronization or locks.
Since the version 3.4, this class extends the interface. However some methods are only accessible in Java.
package |
Default |
---|
__construct()
clear() : void
close() : void
containsKey( $arg0) : boolean
object
boolean
{@code true} if this map contains a mapping for the specified key
containsValue( $arg0) : boolean
object
boolean
@{code true} if this map maps one or more keys to the specified value
get( $arg0) : object
object
object
the value, or null if none
getOrDefault( $arg0, $arg1) : object
object
object
object
the value to which the specified key is mapped, or {@code defaultValue} if this map contains no mapping for the key
isEmpty() : boolean
boolean
true if there are zero entries in the map
put( $arg0, $arg1) : object
object
object
object
return the old value, or null if none
putIfAbsent( $arg0, $arg1) : object
object
object
object
the old value or null, if none
remove( $arg0) : object
object
object
the old value
removeIfPresent( $arg0, $arg1) : boolean
This method is the poyglot version of @see \io\vertx\jphp\core\shareddata\LocalMap::remove.
object
object
boolean
true if removed
replace( $arg0, $arg1) : object
object
object
object
the old value
replaceIfPresent( $arg0, $arg1, $arg2) : boolean
This method is the polyglot version of @see \io\vertx\jphp\core\shareddata\LocalMap::replace.
object
object
object
boolean
true if removed
size() : integer
integer
the number of entries in the map