TransactionalMap

class TransactionalMap(name, transaction, context)[source]

Bases: hazelcast.proxy.base.TransactionalProxy

Transactional implementation of Map.

contains_key(key)[source]

Transactional implementation of Map.contains_key(key)

Parameters

key – The specified key.

Returns

True if this map contains an entry for the specified key, False otherwise.

Return type

hazelcast.future.Future[bool]

get(key)[source]

Transactional implementation of Map.get(key)

Parameters

key – The specified key.

Returns

The value for the specified key.

Return type

hazelcast.future.Future[any]

get_for_update(key)[source]

Locks the key and then gets and returns the value to which the specified key is mapped.

Lock will be released at the end of the transaction (either commit or rollback).

Parameters

key – The specified key.

Returns

The value for the specified key.

Return type

hazelcast.future.Future[any]

See also

Map.get(key)

size()[source]

Transactional implementation of Map.size()

Returns

Number of entries in this map.

Return type

hazelcast.future.Future[int]

is_empty()[source]

Transactional implementation of Map.is_empty()

Returns

True if this map contains no key-value mappings, False otherwise.

Return type

hazelcast.future.Future[bool]

put(key, value, ttl=None)[source]

Transactional implementation of Map.put(key, value, ttl)

The object to be put will be accessible only in the current transaction context till the transaction is committed.

Parameters
  • key – The specified key.

  • value – The value to associate with the key.

  • ttl (int) – Maximum time in seconds for this entry to stay.

Returns

Previous value associated with key or None if there was no mapping for key.

Return type

hazelcast.future.Future[any]

put_if_absent(key, value)[source]

Transactional implementation of Map.put_if_absent(key, value)

The object to be put will be accessible only in the current transaction context till the transaction is committed.

Parameters
  • key – Key of the entry.

  • value – Value of the entry.

Returns

Old value of the entry.

Return type

hazelcast.future.Future[any]

set(key, value)[source]

Transactional implementation of Map.set(key, value)

The object to be set will be accessible only in the current transaction context till the transaction is committed.

Parameters
  • key – Key of the entry.

  • value – Value of the entry.

Returns

Return type

hazelcast.future.Future[None]

replace(key, value)[source]

Transactional implementation of Map.replace(key, value)

The object to be replaced will be accessible only in the current transaction context till the transaction is committed.

Parameters
  • key – The specified key.

  • value – The value to replace the previous value.

Returns

Previous value associated with key, or None if there was no mapping for key.

Return type

hazelcast.future.Future[any]

replace_if_same(key, old_value, new_value)[source]

Transactional implementation of Map.replace_if_same(key, old_value, new_value)

The object to be replaced will be accessible only in the current transaction context till the transaction is committed.

Parameters
  • key – The specified key.

  • old_value – Replace the key value if it is the old value.

  • new_value – The new value to replace the old value.

Returns

True if the value was replaced, False otherwise.

Return type

hazelcast.future.Future[bool]

remove(key)[source]

Transactional implementation of Map.remove(key)

The object to be removed will be removed from only the current transaction context until the transaction is committed.

Parameters

key – Key of the mapping to be deleted.

Returns

The previous value associated with key, or None if there was no mapping for key.

Return type

hazelcast.future.Future[any]

remove_if_same(key, value)[source]

Transactional implementation of Map.remove_if_same(key, value)

The object to be removed will be removed from only the current transaction context until the transaction is committed.

Parameters
  • key – The specified key.

  • value – Remove the key if it has this value.

Returns

True if the value was removed, False otherwise.

Return type

hazelcast.future.Future[bool]

delete(key)[source]

Transactional implementation of Map.delete(key)

The object to be deleted will be removed from only the current transaction context until the transaction is committed.

Parameters

key – Key of the mapping to be deleted.

Returns

Return type

hazelcast.future.Future[None]

key_set(predicate=None)[source]

Transactional implementation of Map.key_set(predicate)

Parameters

predicate (hazelcast.predicate.Predicate) – Predicate to filter the entries.

Returns

A list of the clone of the keys.

Return type

hazelcast.future.Future[list]

values(predicate=None)[source]

Transactional implementation of Map.values(predicate)

Parameters

predicate (hazelcast.predicate.Predicate) – Predicate to filter the entries.

Returns

A list of clone of the values contained in this map.

Return type

hazelcast.future.Future[list]