Set¶
- class Set(service_name, name, context)[source]¶
Bases:
hazelcast.proxy.base.PartitionSpecificProxy
Concurrent, distributed implementation of Set
- add(item)[source]¶
Adds the specified item if it is not exists in this set.
- Parameters
item – The specified item to be added.
- Returns
True
if this set is changed after call,False
otherwise.- Return type
hazelcast.future.Future[bool]
- add_all(items)[source]¶
Adds the elements in the specified collection if they’re not exist in this set.
- Parameters
items (list) – Collection which includes the items to be added.
- Returns
True
if this set is changed after call,False
otherwise.- Return type
hazelcast.future.Future[bool]
- add_listener(include_value=False, item_added_func=None, item_removed_func=None)[source]¶
Adds an item listener for this container.
Listener will be notified for all container add/remove events.
- Parameters
include_value (bool) – Whether received events include the updated item or not.
item_added_func (function) – Function to be called when an item is added to this set.
item_removed_func (function) – Function to be called when an item is deleted from this set.
- Returns
A registration id which is used as a key to remove the listener.
- Return type
- clear()[source]¶
Clears the set. Set will be empty with this call.
- Returns
- Return type
hazelcast.future.Future[None]
- contains(item)[source]¶
Determines whether this set contains the specified item or not.
- Parameters
item – The specified item to be searched.
- Returns
True
if the specified item exists in this set,False
otherwise.- Return type
hazelcast.future.Future[bool]
- contains_all(items)[source]¶
Determines whether this set contains all of the items in the specified collection or not.
- Parameters
items (list) – The specified collection which includes the items to be searched.
- Returns
True
if all of the items in the specified collection exist in this set,False
otherwise.- Return type
hazelcast.future.Future[bool]
- get_all()[source]¶
Returns all of the items in the set.
- Returns
List of the items in this set.
- Return type
hazelcast.future.Future[list]
- is_empty()[source]¶
Determines whether this set is empty or not.
- Returns
True
if this set is empty,False
otherwise.- Return type
hazelcast.future.Future[bool]
- remove(item)[source]¶
Removes the specified element from the set if it exists.
- Parameters
item – The specified element to be removed.
- Returns
True
if the specified element exists in this set,False
otherwise.- Return type
hazelcast.future.Future[bool]
- remove_all(items)[source]¶
Removes all of the elements of the specified collection from this set.
- Parameters
items (list) – The specified collection.
- Returns
True
if the call changed this set,False
otherwise.- Return type
hazelcast.future.Future[bool]
- remove_listener(registration_id)[source]¶
Removes the specified item listener.
Returns silently if the specified listener was not added before.
- Parameters
registration_id (str) – Id of the listener to be deleted.
- Returns
True
if the item listener is removed,False
otherwise.- Return type
hazelcast.future.Future[bool]
- retain_all(items)[source]¶
Removes the items which are not contained in the specified collection.
In other words, only the items that are contained in the specified collection will be retained.
- Parameters
items (list) – Collection which includes the elements to be retained in this set.
- Returns
True
if this set changed as a result of the call,False
otherwise.- Return type
hazelcast.future.Future[bool]