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
mixed
boolean
{@code true} if this map contains a mapping for the specified key
containsValue( $arg0) : boolean
mixed
boolean
@{code true} if this map maps one or more keys to the specified value
get( $arg0) : mixed
mixed
mixed
the value, or null if none
getOrDefault( $arg0, $arg1) : mixed
mixed
mixed
mixed
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) : mixed
mixed
mixed
mixed
return the old value, or null if none
putIfAbsent( $arg0, $arg1) : mixed
mixed
mixed
mixed
the old value or null, if none
remove( $arg0) : mixed
mixed
mixed
the old value
removeIfPresent( $arg0, $arg1) : boolean
This method is the poyglot version of @see \io\vertx\jphp\core\shareddata\LocalMap::remove.
mixed
mixed
boolean
true if removed
replace( $arg0, $arg1) : mixed
mixed
mixed
mixed
the old value
replaceIfPresent( $arg0, $arg1, $arg2) : boolean
This method is the polyglot version of @see \io\vertx\jphp\core\shareddata\LocalMap::replace.
mixed
mixed
mixed
boolean
true if removed
size() : integer
integer
the number of entries in the map