coin 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/Gemfile.lock +1 -8
  2. data/README.md +11 -4
  3. data/lib/coin.rb +12 -1
  4. data/lib/coin/version.rb +1 -1
  5. metadata +3 -3
@@ -3,23 +3,16 @@ GEM
3
3
  specs:
4
4
  coderay (1.0.8)
5
5
  method_source (0.8.1)
6
- micro_test (0.3.1)
6
+ micro_test (0.3.2)
7
7
  os
8
8
  os (0.9.6)
9
9
  pry (0.9.10)
10
10
  coderay (~> 1.0.5)
11
11
  method_source (~> 0.8)
12
12
  slop (~> 3.3.1)
13
- pry (0.9.10-java)
14
- coderay (~> 1.0.5)
15
- method_source (~> 0.8)
16
- slop (~> 3.3.1)
17
- spoon (~> 0.0)
18
13
  slop (3.3.3)
19
- spoon (0.0.1)
20
14
 
21
15
  PLATFORMS
22
- java
23
16
  ruby
24
17
 
25
18
  DEPENDENCIES
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Memcached? We don't need no stinking Memcached. <sup><a href="#cultural-references">1</a></sup>
4
4
 
5
- Well... you might depending upon your specific needs.,
5
+ Well... you might depending upon your specific needs,
6
6
  but have a look at Coin before you reach for the sledgehammer.
7
7
 
8
8
  Coin is an absurdly simple in memory object caching system written in Ruby.
@@ -104,6 +104,13 @@ Coin.start_server # => true
104
104
  Coin.start_server true # => true
105
105
  ```
106
106
 
107
+ Coin also supports configuring a remote server.
108
+ Allowing a single Coin server to service multiple machines.
109
+
110
+ ```ruby
111
+ Coin.remote_uri = "druby://192.168.0.12:8808"
112
+ ```
113
+
107
114
  ## Best Practices
108
115
 
109
116
  All objects stored with Coin must be able to marshal.
@@ -136,10 +143,10 @@ $ mt
136
143
 
137
144
  Coin's default behavior launches a single DRb server that provides
138
145
  shared access across all processes on a **single machine**.
146
+ You need to configure `Coin.remote_uri` if you want Coin to connect to a
147
+ DRb server on another machine.
139
148
 
140
- _It should be relatively simple to update Coin to work across multiple machines,
141
- so keep an eye peeled for this feature in the future._
142
-
149
+ ![Coin Diagram](https://raw.github.com/hopsoft/coin/gh-pages/assets/images/coin.png)
143
150
 
144
151
  ## Cultural References
145
152
 
@@ -27,10 +27,16 @@ module Coin
27
27
 
28
28
  attr_writer :uri
29
29
  def uri
30
- "druby://localhost:#{port}"
30
+ @uri ||= "druby://localhost:#{port}"
31
+ end
32
+
33
+ attr_reader :remote_uri
34
+ def remote_uri=(value)
35
+ @remote_uri = value
31
36
  end
32
37
 
33
38
  def server
39
+ return remote_server if remote_uri
34
40
  return nil unless ENV["COIN_URI"].nil?
35
41
 
36
42
  if server_running?
@@ -58,6 +64,11 @@ module Coin
58
64
  @server = DRbObject.new_with_uri(uri)
59
65
  end
60
66
 
67
+ def remote_server
68
+ DRb.start_service
69
+ @server = DRbObject.new_with_uri(remote_uri)
70
+ end
71
+
61
72
  def pid_file
62
73
  "/tmp/coin-pid-63f95cb5-0bae-4f66-88ec-596dfbac9244"
63
74
  end
@@ -1,3 +1,3 @@
1
1
  module Coin
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,9 +9,9 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-05 00:00:00.000000000 Z
12
+ date: 2012-12-06 00:00:00.000000000 Z
13
13
  dependencies: []
14
- description:
14
+ description: ''
15
15
  email:
16
16
  - natehop@gmail.com
17
17
  executables: []