Skip to content
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.

Global Data

tarcieri edited this page Apr 17, 2012 · 3 revisions

DCell provides a globally accessible directory of any Ruby object you wish to store. Global data can be used to transfer any data you wish between nodes, including handles to actors. This lets you globally register an actor such that it's accessible from every node without first having to locate the node it's on:

>> actor = Celluloid::Actor[:dcell_server]
 => #<Celluloid::Actor(DCell::Server:0xf2e) @addr="tcp://127.0.0.1:7777">
>> DCell::Global[:sweet_server] = actor
 => #<Celluloid::Actor(DCell::Server:0xf2e) @addr="tcp://127.0.0.1:7777">
>> DCell::Global[:sweet_server]
 => #<Celluloid::Actor(DCell::Server:0xf2e) @addr="tcp://127.0.0.1:7777">

DCell::Global is not intended for a write-heavy load, such as storing values that exist over a single HTTP request lifecycle. It's intended for values that are intended to be largely persistent, short of configuration changes or hardware failures. If you're looking for a write-heavy store for fleeting data, you might want to look into one of those database things.

Clone this wiki locally