Package core :: Module shared_data :: Class SharedData

[hide private]
[frames] | no frames]

# Class SharedData

source code

    object --+
             |
            SharedData

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 | [hide private]

shared_data() | source code

get_hash(key) Return a Hash with the specific name. | source code

get_set(key) Return a Set with the specific name. | source code

remove_hash(key) Remove the hash | source code

remove_set(key) Remove the set | source code

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) | source code

Method Details | [hide private]

### get_hash(key)
Static Method

source code

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:

Parameters:
  - `key` - Get the hash with the key.
Returns:
  the hash.

### get_set(key)
Static Method

source code

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:

Parameters:
  - `key` - Get the set with the key.
Returns:
  the shared set.

### remove_hash(key)
Static Method

source code

Remove the hash

Keyword arguments:

Parameters:
  - `key` - The key of the hash.

### remove_set(key)
Static Method

source code

Remove the set

Keyword arguments:

Parameters:
  - `key` - The key of the set.