SharedData

Shared data allows you to share data safely between different parts of your application in a safe way.

Shared data provides:

  • synchronous shared maps (local)
  • asynchronous maps (local or cluster-wide)
  • asynchronous locks (local or cluster-wide)
  • asynchronous counters (local or cluster-wide)

WARNING: In clustered mode, asynchronous maps/locks/counters rely on distributed data structures provided by the cluster manager. Beware that the latency relative to asynchronous maps/locks/counters operations can be much higher in clustered than in local mode.

Please see the documentation for more information.
package

Default

Methods

__construct

__construct() 

Get the @see \io\vertx\jphp\core\shareddata\AsyncMap with the specified name. When clustered, the map is accessible to all nodes in the cluster and data put into the map from any node is visible to to any other node.

getAsyncMap( $arg0,  $arg1) : void

WARNING: In clustered mode, asynchronous shared maps rely on distributed data structures provided by the cluster manager. Beware that the latency relative to asynchronous shared maps operations can be much higher in clustered than in local mode.

Arguments

$arg0

string

$arg1

callable

Get the cluster wide map with the specified name. The map is accessible to all nodes in the cluster and data put into the map from any node is visible to to any other node.

getClusterWideMap( $arg0,  $arg1) : void

Arguments

$arg0

string

$arg1

callable

Get an asynchronous counter. The counter will be passed to the handler.

getCounter( $arg0,  $arg1) : void

Arguments

$arg0

string

$arg1

callable

Return a <code>LocalMap</code> with the specific <code>name</code>.

getLocalMap( $arg0) : \io\vertx\jphp\core\shareddata\LocalMap<K,V>

Arguments

$arg0

string

Response

\io\vertx\jphp\core\shareddata\LocalMap

the msp

Get an asynchronous lock with the specified name. The lock will be passed to the handler when it is available.

getLock( $arg0,  $arg1) : void

In general lock acquision is unordered, so that sequential attempts to acquire a lock, even from a single thread, can happen in non-sequential order.

Arguments

$arg0

string

$arg1

callable

Like @see \io\vertx\jphp\core\shareddata\SharedData::getLock but specifying a timeout. If the lock is not obtained within the timeout a failure will be sent to the handler.

getLockWithTimeout( $arg0,  $arg1,  $arg2) : void

In general lock acquision is unordered, so that sequential attempts to acquire a lock, even from a single thread, can happen in non-sequential order.

Arguments

$arg0

string

$arg1

integer

$arg2

callable