| |
- __builtin__.object
-
- SharedData
- SharedHash
- SharedSet
class SharedData(__builtin__.object) |
|
Sometimes it is desirable to share immutable data between different event loops, for example to implement a
cache of data.
This class allows instances of shareddata data structures to be looked up and used from different event loops.
The data structures themselves will only allow certain data types to be stored into them. This shields the
user from worrying about any thread safety issues might occur if mutable objects were shareddata between event loops.
The following types can be stored in a shareddata data structure:
String
FixNum
Float
Buffer - this will be automatically copied, and the copy will be stored in the structure. |
|
Static methods defined here:
- check_obj(obj)
- Convert to corresponding Java objects
and make copies where appropriate (the underlying java map will also make copies for some data types too)
- get_hash(key)
- Return a Hash with the specific name. All invocations of this method with the same value of name
are guaranteed to return the same Hash instance.
Keyword arguments:
@param key: Get the hash with the key.
@return: the hash.
- get_set(key)
- Return a Set with the specific name. All invocations of this method with the same value of name
are guaranteed to return the same Set instance.
Keyword arguments:
@param key: Get the set with the key.
@return: the shared set.
- remove_hash(key)
- Remove the hash
Keyword arguments:
@param key: The key of the hash.
- remove_set(key)
- Remove the set
Keyword arguments:
@param key: The key of the set.
- shared_data()
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class SharedSet(__builtin__.object) |
| |
Methods defined here:
- __eq__(self, other)
- __init__(self, java_set)
- __iter__(self)
- __len__(self)
- __str__(self)
- add(self, obj)
- Add an object to the set
Keyword arguments:
@param obj: The object to add
@return: self
- clear(self)
- Clear the set
- delete(self, obj)
- Delete an object from the set
Keyword arguments:
@param obj: the object to delete
- each(self, func)
- Call the func for every element of the set
Keyword arguments:
@param func: The function to call.
- empty(self)
- returns True if the set is empty
- include(self, obj)
- Does the set contain an element?
Keyword arguments:
@param obj: the object to check if the set contains
@return: True if the object is contained in the set
- size(self)
- returns the number of elements in the set
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |