coin 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/coin/version.rb +1 -1
- metadata +59 -11
- data/Gemfile +0 -7
- data/Gemfile.lock +0 -20
- data/LICENSE.txt +0 -22
- data/README.md +0 -153
data/lib/coin/version.rb
CHANGED
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
|
+
version: 0.1.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,26 +9,71 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
14
|
-
|
12
|
+
date: 2013-04-19 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: micro_test
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: pry
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: An absurdly simple in memory object caching system.
|
15
63
|
email:
|
16
64
|
- natehop@gmail.com
|
17
|
-
executables:
|
65
|
+
executables:
|
66
|
+
- coin
|
18
67
|
extensions: []
|
19
68
|
extra_rdoc_files: []
|
20
69
|
files:
|
21
70
|
- lib/coin/vault.rb
|
22
71
|
- lib/coin/version.rb
|
23
72
|
- lib/coin.rb
|
73
|
+
- bin/coin
|
24
74
|
- test/coin_test.rb
|
25
75
|
- test/test_helper.rb
|
26
76
|
- test/vault_test.rb
|
27
|
-
- bin/coin
|
28
|
-
- Gemfile
|
29
|
-
- Gemfile.lock
|
30
|
-
- LICENSE.txt
|
31
|
-
- README.md
|
32
77
|
homepage: https://github.com/hopsoft/coin
|
33
78
|
licenses:
|
34
79
|
- MIT
|
@@ -54,5 +99,8 @@ rubygems_version: 1.8.23
|
|
54
99
|
signing_key:
|
55
100
|
specification_version: 3
|
56
101
|
summary: An absurdly simple in memory object caching system.
|
57
|
-
test_files:
|
102
|
+
test_files:
|
103
|
+
- test/coin_test.rb
|
104
|
+
- test/test_helper.rb
|
105
|
+
- test/vault_test.rb
|
58
106
|
has_rdoc:
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: https://rubygems.org/
|
3
|
-
specs:
|
4
|
-
coderay (1.0.8)
|
5
|
-
method_source (0.8.1)
|
6
|
-
micro_test (0.3.2)
|
7
|
-
os
|
8
|
-
os (0.9.6)
|
9
|
-
pry (0.9.10)
|
10
|
-
coderay (~> 1.0.5)
|
11
|
-
method_source (~> 0.8)
|
12
|
-
slop (~> 3.3.1)
|
13
|
-
slop (3.3.3)
|
14
|
-
|
15
|
-
PLATFORMS
|
16
|
-
ruby
|
17
|
-
|
18
|
-
DEPENDENCIES
|
19
|
-
micro_test
|
20
|
-
pry
|
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2012 Nathan Hopkins
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,153 +0,0 @@
|
|
1
|
-
# Coin
|
2
|
-
|
3
|
-
## Memcached? We don't need no stinking Memcached. <sup><a href="#cultural-references">1</a></sup>
|
4
|
-
|
5
|
-
Well... you might depending upon your specific needs,
|
6
|
-
but have a look at Coin before you reach for the sledgehammer.
|
7
|
-
|
8
|
-
Coin is an absurdly simple in memory object caching system written in Ruby.
|
9
|
-
|
10
|
-
## Why Coin?
|
11
|
-
|
12
|
-
* No configuration required
|
13
|
-
* No added complexity to your stack
|
14
|
-
* Small footprint (under 200 lines)
|
15
|
-
* Simple API
|
16
|
-
|
17
|
-
Coin uses [Distributed Ruby (DRb)](http://pragprog.com/book/sidruby/the-druby-book)
|
18
|
-
to create a simple in memory caching server that addresses many of the same needs as Memcached
|
19
|
-
and other similar solutions.
|
20
|
-
|
21
|
-
## Quick Start
|
22
|
-
|
23
|
-
Installation
|
24
|
-
|
25
|
-
```bash
|
26
|
-
$ gem install coin
|
27
|
-
```
|
28
|
-
|
29
|
-
Basic Usage
|
30
|
-
|
31
|
-
```ruby
|
32
|
-
require "coin"
|
33
|
-
Coin.write :foo, true
|
34
|
-
Coin.read :foo # => true
|
35
|
-
```
|
36
|
-
|
37
|
-
## Next Steps
|
38
|
-
|
39
|
-
Examples of more advanced usage.
|
40
|
-
|
41
|
-
```ruby
|
42
|
-
require "coin"
|
43
|
-
|
44
|
-
# read and/or assign a default value in a single step
|
45
|
-
Coin.read(:bar) { true } # => true
|
46
|
-
|
47
|
-
# write data with an explicit expiration (in seconds)
|
48
|
-
# this example expires in 5 seconds (default is 300)
|
49
|
-
Coin.write :bar, true, 5
|
50
|
-
sleep 5
|
51
|
-
Coin.read :bar # => nil
|
52
|
-
|
53
|
-
# delete an entry
|
54
|
-
Coin.write :bar, true
|
55
|
-
Coin.delete :bar
|
56
|
-
Coin.read :bar # => nil
|
57
|
-
|
58
|
-
# read and delete in a single step
|
59
|
-
Coin.write :bar, true
|
60
|
-
Coin.read_and_delete :bar # => true
|
61
|
-
Coin.read :bar # => nil
|
62
|
-
|
63
|
-
# determine how many items are in the cache
|
64
|
-
10.times do |i|
|
65
|
-
Coin.write "key#{i}", true
|
66
|
-
end
|
67
|
-
Coin.length # => 10
|
68
|
-
|
69
|
-
# clear the cache
|
70
|
-
Coin.clear
|
71
|
-
Coin.length # => 0
|
72
|
-
```
|
73
|
-
|
74
|
-
## Deep Cuts
|
75
|
-
|
76
|
-
Coin automatically starts a DRb server that hosts the Coin::Vault.
|
77
|
-
You can take control of this behavior if needed.
|
78
|
-
|
79
|
-
```ruby
|
80
|
-
require "coin"
|
81
|
-
|
82
|
-
# configure the port that the DRb server runs on (default is 8955)
|
83
|
-
Coin.port = 8080
|
84
|
-
|
85
|
-
# configure the URI that the DRb server runs on (defaults to druby://localhost:PORT)
|
86
|
-
Coin.uri = "druby://10.0.0.100:8080"
|
87
|
-
|
88
|
-
# access the DRb server exposing Coin::Vault
|
89
|
-
Coin.server # => #<Coin::Vault:0x007fe182852e18>
|
90
|
-
|
91
|
-
# determine if the server is running
|
92
|
-
Coin.server_running? # => true
|
93
|
-
|
94
|
-
# determine the pid of the server process
|
95
|
-
Coin.pid # => "63299"
|
96
|
-
|
97
|
-
# stop the server
|
98
|
-
Coin.stop_server # => true
|
99
|
-
|
100
|
-
# start the server
|
101
|
-
Coin.start_server # => true
|
102
|
-
|
103
|
-
# start the server forcing a restart if the server is already running
|
104
|
-
Coin.start_server true # => true
|
105
|
-
```
|
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
|
-
|
114
|
-
## Best Practices
|
115
|
-
|
116
|
-
All objects stored with Coin must be able to marshal.
|
117
|
-
|
118
|
-
Its generally a good idea to store only the most basic objects.
|
119
|
-
For example:
|
120
|
-
|
121
|
-
* Boolean
|
122
|
-
* String
|
123
|
-
* Number
|
124
|
-
|
125
|
-
Its possible to store more complex objects such as:
|
126
|
-
|
127
|
-
* Array
|
128
|
-
* Hash
|
129
|
-
|
130
|
-
Just be sure to limit the keys & values to basic types.
|
131
|
-
|
132
|
-
## Run the Tests
|
133
|
-
|
134
|
-
```bash
|
135
|
-
$ gem install coin
|
136
|
-
$ gem unpack coin
|
137
|
-
$ cd coin-VERSION
|
138
|
-
$ bundle
|
139
|
-
$ mt
|
140
|
-
```
|
141
|
-
|
142
|
-
## Notes
|
143
|
-
|
144
|
-
Coin's default behavior launches a single DRb server that provides
|
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.
|
148
|
-
|
149
|
-
![Coin Diagram](https://raw.github.com/hopsoft/coin/gh-pages/assets/images/coin.png)
|
150
|
-
|
151
|
-
## Cultural References
|
152
|
-
|
153
|
-
1. "Badges? We don't need no stinking badges!" - from Mel Brooks' film [Blazing Saddles](http://en.wikipedia.org/wiki/Stinking_badges)
|